Write a program to print prime nums from 1-20 using c
programing?
Answer Posted / rupamrox
#include<stdio.h>
#include<conio.h>
main()
{
int i,j,prime;
clrscr();
for(i=2;i<20;i++)
{
prime=1;
for(j=2;j<i;j++)
{
if(i%j==0)
prime=0;
}
if(prime==1)
printf("%d",i);
}
getch();
}
| Is This Answer Correct ? | 9 Yes | 7 No |
Post New Answer View All Answers
Can math operations be performed on a void pointer?
Explain what are the different data types in c?
What is the process to generate random numbers in c programming language?
What is the difference between int main and void main?
Give me the code of in-order recursive and non-recursive.
What is the maximum no. of arguments that can be given in a command line in C.?
What is use of integral promotions in c?
What are the different types of control structures?
The statement, int(*x[]) () what does in indicate?
What is echo in c programming?
1.int a=10; 2.int b=20; 3. //write here 4.b=30; Write code at line 3 so that when the value of b is changed variable a should automatically change with same value as b. 5.
Describe the order of precedence with regards to operators in C.
How many header files are in c?
Explain About fork()?
How will you divide two numbers in a MACRO?