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 is the difference between far and near in c?
What are the types of pointers?
What are the restrictions of a modulus operator?
Is c still relevant?
How can I prevent another program from modifying part of a file that I am modifying?
What are enums in c?
What is the use of sizeof?
How can variables be characterized?
What is data type long in c?
How a string is stored in c?
Write a program to produce the following output: 1 2 3 4 5 6 7 8 9 10
What are the benefits of c language?
Why is c still so popular?
How is a null pointer different from a dangling pointer?
How does #define work?