- 5
Let the sequence of numbers, which ends 0
Write a program that counts the amount of sequence numbers, numbers which are prime numbers. use cycle do..while. without arrays.
1 Réponse
+ 2
Well you cannot make this code for a sequence of numbers without making use of arrays but you can still check weather a number is prime or not
int main ()
{
int a,b=2;
cin>>a;
do{
if(a/b==0){
cout<<"it is not prime ";
break;
}
else{
continue;
}
++b;
}while(b<a)
return 0;
}
THE CODE WORKS IN SIMPLE WAY IT DIVIDES ALL THE NUMBER BEFORE THE INPUT NUMBER TO CHECK IF IT IS DIVIDED BY ANY AND IF NOT IT IS PRIME
point* if it is prime nothing will be displayed
#SiD