write the program for prime numbers?
Answer Posted / pratibha
#include<stdio.h>
#include<conio.h>
void main()
{
int no,i,count=0;
clrscr();
printf("enter the no");
scanf("%d",&no);
for(i=1;i<=no;i++)
{
if(no%i==0)
{
count=count+1;
}
}
if(count<=2)
{
printf("this is prime no");
}
else
{
printf("this is not prime");
}
getch();
}
Is This Answer Correct ? | 17 Yes | 14 No |
Post New Answer View All Answers
How do you initialize pointer variables?
Is c# a good language?
What do you mean by Recursion Function?
What is the translation phases used in c language?
What is dynamic variable in c?
What are the storage classes in C?
Program to find the sum of digits of a given number until the sum becomes a single digit. (e.g. 12345=>1+2+3+4+5=15=>1+5=6)
Write a program of advanced Fibonacci series.
Which is better malloc or calloc?
What is difference between && and & in c?
What is || operator and how does it function in a program?
What does 3 periods mean in texting?
Is Exception handling possible in c language?
What is logical error?
Explain what is the difference between a free-standing and a hosted environment?