Answer:
#include <bits/stdc++.h>
using namespace std;
bool isPrime(int n)
{
for(int j=2;j<=n-1;j++) //loop to check prime..
{
if(n%j==0)
return false;
}
return true;
}
int main(){
int n;
cout<<"Enter the integer"<<endl;//taking input..
cin>>n;
if(isPrime(n))//printing the message.
{
cout<<"The number you have entered is prime"<<endl;
}
else
{
cout<<"The number is not prime"<<endl;
}
return 0;
}
Output:-
Enter the integer
13
The number you have entered is prime
Explanation:
The above written program is in C++.I have created a function called isPrime with an argument n.I have used a for loop to check if the number is prime or not.In the main function I have called the function isPrime for checking the number is prime or not.
A hand draw sketch is drawing with just a pencil and paper. Also, a working drawing is a drawing on at a job. The 3D sketch is on the computer.
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
Answer:
i dont know sorry but answer above lol
Explanation:
Explanation:
public class Int_List
{
protected int[] list;
protected int numEle = 0;
public Int_List( int size )
{
list = new int[size];
public void add( int value )
{
if ( numEle == list.length )
{
System.out.println( "List is full" );
}
else
{
list[numEle] = value;
numEle++;
}
}
public String toString()
{
String returnStr = "";
for ( int x = 0; x < numEle; x++ )
{
returnStr += x + ": " + list[x] + "\n";
}
return returnStr;
}
}
public class Run_List_Test
{
public static void main( String[] args )
{
Int_List myList = new Int_List( 7 );
myList.add( 102 );
myList.add( 51 );
myList.add( 202 );
myList.add( 27 );
System.out.println( myList );
}
}
Note: Use appropriate keyword when you override "tostring" method