write the program for prime numbers?
Answer Posted / sikendar kumar
#include<stdio.h>
#include<conio.h>
main()
{
int i,n,count=0;
clrscr();
printf("enter a no.");
scanf("%d",&n);
for(i=2;i<=n;i++)
{
if(n%i==0)
{
count++;
}
}
if(count==1)
{
printf("not prime no.");
}
else
printf("prime");
return 0;
}
| Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
Define circular linked list.
What are the basic data types associated with c?
Explain how can you determine the size of an allocated portion of memory?
write a program to print largest number of each row of a 2D array
Explain how do you print only part of a string?
can any one tel me wt is the question pattern for NIC exam
Why is c called a mid-level programming language?
ATM machine and railway reservation class/object diagram
Why does everyone say not to use scanf? What should I use instead?
Explain what standard functions are available to manipulate strings?
How can I find out the size of a file, prior to reading it in?
What is the difference between int main and void main?
find the output? void r(int a[],int c, int n) { if(c>n) { a[c]=a[c]+c; r(a,++c,n); r(a,++c,n); } } int main() { int i,a[5]={0}; r(a,0,5); for(i=0;i<5;i++) printf("\n %d",a[i]); getch(); }
What is page thrashing?
Explain the properties of union.