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
if p is a string contained in a string?
What is dynamic memory allocation?
What is a rvalue?
How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?
Do you know what are the properties of union in c?
What is bash c?
Write a program to swap two numbers without using third variable?
the maximum length of a character constant can be a) 1 character b) 8 characters c) 256 chaacters d) 125 characters
What is the scope of an external variable in c?
What are reserved words?
How do I get a null pointer in my programs?
What are type modifiers in c?
int far *near * p; means
i have a written test for microland please give me test pattern
Why do we need a structure?