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
Stimulate calculator using Switch-case-default statement for two numbers
Explain pointer. What are function pointers in C?
Explain #pragma statements.
Write a c program to demonstrate character and string constants?
Why c is faster than c++?
What is linear search?
Can you apply link and association interchangeably?
Explain the difference between malloc() and calloc() function?
Why is main function so important?
What is header file definition?
What is the stack in c?
What is a c token and types of c tokens?
What's the right way to use errno?
What are the general description for loop statement and available loop types in c?
Is Exception handling possible in c language?