Write a program to print the prime numbers from 1 to 100?
Answer Posted / nikith
#include<stdio.h>
#include<conio.h>
int main()
{
int num,n,div,p;
printf("Enter any number: ");
scanf("%d", &num);
for(n=2; n<=num; n++)
{
for(div=2; div<n; div++)
{
if(n%div==0)
{
p=0;
break;
}
p=1;
}
if(p)
printf("\t%d",n);
}
getch();
return 0;
}
| Is This Answer Correct ? | 8 Yes | 8 No |
Post New Answer View All Answers
Write a program to check armstrong number in c?
What is ambagious result in C? explain with an example.
what value is returned to operating system after program execution?
What is typedf?
i got 75% in all semester am i eligible for your company
If one class contains another class as a member, in what order are the two class constructors called a) Constructor for the member class is called first b) Constructor for the member class is called second c) Only one of the constructors is called d) all of the above
Why c is called free form language?
How can I automatically locate a programs configuration files in the same directory as the executable?
Which of the following operators is incorrect and why? ( >=, <=, <>, ==)
write a program that types this pattern: 12345678987654321 12345678 87654321 1234567 7654321 123456 654321 12345 54321 1234 4321 123 321 12 21 1 1
Explain how do you generate random numbers in c?
How do I read the arrow keys? What about function keys?
while initialization of array why we use a[][2] why not a[2][]...?
Is c still relevant?
What is c system32 taskhostw exe?