write the program for prime numbers?
Answer Posted / harpreet dhillon
#include<stdio.h> \\harpreetdhillon7@gmail.com
#include<conio.h>
void main()
{
int i,n;
clrscr();
printf("enter any number which you want to check");
scanf("%d",&n);
for(i=2;i<=n-1;i++)
{
if(n%i==0)
{
printf("not a prime number\n");
break;
}
else
{
printf("prime number\n");
break;
}
}
Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
#include main() { int *p, *c, i; i = 5; p = (int*) (malloc(sizeof(i))); printf(" %d",*p); *p = 10; printf(" %d %d",i,*p); c = (int*) calloc(2); printf(" %d ",*c); }
Define and explain about ! Operator?
How pointers are declared?
How can I do peek and poke in c?
What are the key features in c programming language?
Why doesnt this code work?
Why do we need volatile in c?
Is malloc memset faster than calloc?
Explain what is wrong with this program statement? Void = 10;
What is the best way of making my program efficient?
In c language can we compile a program without main() function?
What are header files and explain what are its uses in c programming?
What is c basic?
How can I pad a string to a known length?
Is it possible to use curly brackets ({}) to enclose single line code in c program?