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
What is the difference between ++a and a++?
How is actual parameter different from the formal parameter?
Write a program to print ASCII code for a given digit.
What is typedf?
Is that possible to add pointers to each other?
Write a code to achieve inter processor communication (mutual exclusion implementation pseudo code)?
Is r written in c?
Is there any demerits of using pointer?
Explain 'far' and 'near' pointers in c.
Write a program to reverse a string.
What is structure of c program?
how can f be used for both float and double arguments in printf? Are not they different types?
Why do we use int main?
How does normalization of huge pointer works?
What is an array? What the different types of arrays in c?