Write a program to print prime nums from 1-20 using c
programing?

Answer Posted / ankur mohan sharma

#include<stdio.h>
#include<conio.h>
int main()
{
int i,n;
for(n=2;n<=20;n++)
{
for(i=2;i<n;i++)
{if(n%i==0)
break;}
}
if(i==n)
printf("\n %d",n);
return 0;

}

Is This Answer Correct ?    2 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is it that not all header files are declared in every C program?

683


What is sizeof int in c?

603


What does == mean in texting?

665


Tell me about low level programming languages.

644


What is the explanation for modular programming?

686






What are pointers in C? Give an example where to illustrate their significance.

751


What is a char in c?

556


How can I change their mode to binary?

698


List the difference between a 'copy constructor' and a 'assignment operator' in C?

637


What is typedef example?

616


What standard functions are available to manipulate strings?

560


Why is this loop always executing once?

617


"C" language developed by "Dennis Ritchie" at AT & T. his remarks are a) too general, too abstract b) could deal with only specific problems c) lost generality of BCPL and B restored d) no remarks

660


Explain what is a static function?

631


why arguments can generally be passed to functions a) sending the values of the arguments b) sending the addresses of the arguments c) a & b d) none of the above

645