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 are data types in c language?
What is enumerated data type in c?
What is c basic?
Why do we need a structure?
Why is c known as a mother language?
In a header file whether functions are declared or defined?
Which one would you prefer - a macro or a function?
What are enums in c?
How to set file pointer to beginning c?
What is optimization in c?
What is union and structure in c?
Why is not a pointer null after calling free?
What is the general form of #line preprocessor?
An integer that indentifies the position of a data item in a sequence of data items a) value b) number c) index d) all of the above
What does double pointer mean in c?