Write a program to print prime nums from 1-20 using c
programing?
Answer Posted / dinesh
#include<stdio.h>
main()
{
int i,j;
for(i=2;i<=20;i++)
{
c=1;
for(j=2;j<i;j++)
{
if(i%j==0)
c=0;
}
if(c==1)
printf("%d",i);
}
}
Is This Answer Correct ? | 46 Yes | 21 No |
Post New Answer View All Answers
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. The Logic should be written in Data Structures?
what is a function method?give example?
How are Structure passing and returning implemented by the complier?
What is selection sort in c?
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
What is register variable in c language?
Can we assign string to char pointer?
Explain Basic concepts of C language?
What is call by reference in functions?
What is an arrays?
Explain the difference between the local variable and global variable in c?
What do you mean by Recursion Function?
Should a function contain a return statement if it does not return a value?
How do I send escape sequences to control a terminal or other device?
What are the 5 types of inheritance in c ++?