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


Please Help Members By Posting Answers For Below Questions

How can I remove the leading spaces from a string?

830


What are the different types of pointers used in c language?

782


What are the features of c languages?

820


What is meant by preprocessor in c?

728


#include show(int t,va_list ptr1) { int a,x,i; a=va_arg(ptr1,int) printf(" %d",a) } display(char) { int x; listptr; va_star(otr,s); n=va_arg(ptr,int); show(x,ptr); } main() { display("hello",4,12,13,14,44); }

991


Why do we write return 0 in c?

770


hi folks i m approching for h1 b interview on monday 8th of august at montreal and i m having little problem in my approval notice abt my bithdate my employer has made a mistake while applying it is 12th january and istead of that he had done 18 the of january do any body have any solution for that if yes how can i prove my visa officer abt my real birthdate it urgent please let me know guys thaks dipesh patel

1621


Did c have any year 2000 problems?

871


What is the role of this pointer?

749


Can I initialize unions?

800


Explain enumerated types in c language?

782


Explain how can you tell whether two strings are the same?

793


Explain how can I prevent another program from modifying part of a file that I am modifying?

851


What is the significance of an algorithm to C programming?

785


What is array within structure?

820