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

When should the volatile modifier be used?

689


Explain high-order bytes.

678


Define and explain about ! Operator?

618


How to find a missed value, if you want to store 100 values in a 99 sized array?

821


For what purpose null pointer used?

609






C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions

615


a direct address that identifies a location by means of its displacement from a base address or segment a) absolute address b) relative address c) relative mode d) absolute mode

661


application attempts to perform an operation?

1497


Are there constructors in c?

600


Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?

585


How can you call a function, given its name as a string?

716


What does the function toupper() do?

661


A c program to display count values from 0 to 100 and flash each digit for a secong.reset the counter after it reaches 100.use for loop,. pls guys hepl me.. :(

1746


Why do we use stdio h and conio h?

642


1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. 2) the Event Manager has to send participants to the stage to perform in the order in which they registered. Write a program that will help the Event Manager know who to call to the stage to perform. The Logic should be in Data Structures

2747