write the program for prime numbers?
Answer Posted / pran pratim
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int num,i,count=0;
cout<<"Enter the number::";
cin>>num;
for(i=2;i<=num/2;i++)
{
if(num%i==0)
{
count++;
break;
}
}
if(count==0)
{
cout<<"The number is Prime";
}
else
cout<<"The number is Composite";
getch();
}
Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
Explain what is wrong with this program statement? Void = 10;
Can a local variable be volatile in c?
What is wild pointer in c?
How are structure passing and returning implemented?
What is extern variable in c with example?
What is s or c?
What is typedef example?
What is wrong with this declaration?
Which driver is a pure java driver
Explain pointers in c programming?
Is exit(status) truly equivalent to returning the same status from main?
What is an identifier?
Why is c platform dependent?
What math functions are available for integers? For floating point?
Can a pointer be volatile in c?