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
What is a built-in function in C?
Why do we use header files in c?
What is the difference between a string and an array?
Explain how do you list files in a directory?
Can we change the value of constant variable in c?
Create a structure to specify data on students given below: Roll number, Name, Department, Course, Year of joining Assume that there are not more than 450 students in the college. 1.write a function to print names of all students who joined in a particular year 2.write a function to print the data of a student whose roll number is given
A program is required to print your biographic information including: Names, gender, student Number, Cell Number, line of study and your residential address.
Explain about the functions strcat() and strcmp()?
What does the format %10.2 mean when included in a printf statement?
What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?
Is c programming hard?
State the difference between realloc and free.
The file stdio.h, what does it contain?
What is the difference between text and binary modes?
What are near, far and huge pointers?