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
What is mean by data types in c?
Are pointers integers in c?
One of the Institutes contains 5 student groups. Every group contains 4 students. Institute wants to store student group’s details in array. Group should contain group member’s details (name and registration number and age), project name, and mark of the group.
What are the different data types in C?
What do you understand by friend-functions? How are they used?
in case any function return float value we must declare a) the function must be declared as 'float' in main() as well b) the function automatically returned float values c) function before declared 'float' keyword d) all the above
What are the functions to open and close file in c language?
What is a nested formula?
What is a MAC Address?
What is typeof in c?
Why isnt there a numbered, multi-level break statement to break out
What is c language used for?
Explain what are the standard predefined macros?
Explain how can you avoid including a header more than once?
What are 'near' and 'far' pointers?