write the program for prime numbers?
Answer Posted / sudesh kumar
#include<iostream.h>
#include<conio.h>
void main()
{
int no;
cout<<"enter a no";
cin>>no;
for(i=2;i<no;i++)
{
r=no%i;
if(r==0)
{
p==0;
break;
}}
if(p==1)
{
cout<<"prime no";
}
else
{
cout<<"note prime";
}
getch();
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What language is lisp written in?
What are file streams?
What does a function declared as pascal do differently?
a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list
FILE PROGRAMMING
What is structure and union in c?
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......
the statement while(i) puts the entire logic in loop. this loop is called a) indefinite loop b) definite loop c) loop syntax wrong d) none of the above
What is New modifiers?
cin.ignore(80, _ _);This statement a) ignores all input b) ignores the first 80 characters in the input c) ignores all input till end-of-line d) iteration
In C language what is a 'dangling pointer'?
Where are c variables stored in memory?
Where is volatile variable stored?
write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?
What is data type long in c?