Write a program to print prime nums from 1-20 using c
programing?
Answer Posted / sreejesh1987
//Ha Ha I'm the creator of shortest code
//for prime numbers
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
clrscr();
printf("\t\t\tPRIME NUMBERS 1-20\n");
printf("\n\t2");
for(i=3;i<=20;i++)
for(j=2;j<i,i%j!=0;j++)
if(i-1==j)
printf("\n\t%d",i);
getch();
}
Is This Answer Correct ? | 6 Yes | 3 No |
Post New Answer View All Answers
Explain what is meant by 'bit masking'?
What is the time and space complexities of merge sort and when is it preferred over quick sort?
Write a c program to demonstrate character and string constants?
What are types of structure?
What is the purpose of scanf() and printf() functions?
What are header files and explain what are its uses in c programming?
What are operators in c?
What are header files in c?
How can I get the current date or time of day in a c program?
What is the auto keyword good for?
Why malloc is faster than calloc?
What is the difference between constant pointer and constant variable?
Write a program to identify if a given binary tree is balanced or not.
write a program in C that prompts the user for today's date,tomorrow's date and display the results.Use structures for today's date,tomorrow's date and an array to hold the days for each month of the year.
What is %d used for?