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
can anyone please tell about the nested interrupts?
What is meant by inheritance?
What’s a signal? Explain what do I use signals for?
What does a derived class inherit from a base class a) Only the Public members of the base class b) Only the Protected members of the base class c) Both the Public and the Protected members of the base class d) .c file
What is sizeof int?
What are Macros? What are its advantages and disadvantages?
How can I direct output to the printer?
Find duplicates in a file containing 6 digit number (like uid) in O (n) time.
What is meant by gets in c?
What are compound statements?
What is the explanation for cyclic nature of data types in c?
What do you mean by scope of a variable in c?
What are the c keywords?
What are lookup tables in c?
What is NULL pointer?