write the program for prime numbers?
Answer Posted / karthikeyan murugesan
hi u can try this one for prime number and generation ::
#include<stdio.h>
void main()
{
int n,i=1,j,c;
scanf("%d",&n);
while(i<=n)
{
c=0;
for(j=1;j<=i;j++)
{
if(i%j==0)
c++;
}
if(c==2)
{
printf("%d",i);
i++;
}
}
getch();
}
Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
Write a program with dynamically allocation of variable.
Is it better to use malloc() or calloc()?
What are the advantages and disadvantages of pointers?
Explain About fork()?
When is the “void” keyword used in a function?
What is the difference between printf and scanf )?
Where are some collections of useful code fragments and examples?
Is Exception handling possible in c language?
Are there namespaces in c?
How can I prevent another program from modifying part of a file that I am modifying?
What is int main () in c?
What is #define?
write a C program: To search a file any word which starts with ?a?. If the word following this ?a? starts with a vowel.Then replace this ?a? with ?a? with ?an?. redirect with the output onto an output file.The source file and destination file are specified by the user int the command line.
What is anagram in c?
Explain what is the difference between #include and #include 'file' ?