Write a program to print prime nums from 1-20 using c
programing?

Answer Posted / bheem rao

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,count=0;
for(i=2;i<=20;i++)
{
for(j=1;j<=i;i++)
{
if(i%j==0)
count++;
}
if(count==2)
printf("%d\n",i);
count=0;
}
}

Is This Answer Correct ?    12 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

write a program to find the given number is prime or not

3837


Write a code of a general series where the next element is the sum of last k terms.

589


Explain what is dynamic data structure?

642


Why clrscr is used in c?

580


Can you think of a logic behind the game minesweeper.

2004






What is a null string in c?

583


Difference between macros and inline functions? Can a function be forced as inline?

706


What is a pointer in c?

677


When should we use pointers in a c program?

626


What is 'bus error'?

641


Explain how do you determine the length of a string value that was stored in a variable?

666


A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference

629


Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon

5462


Explain with the aid of an example why arrays of structures don’t provide an efficient representation when it comes to adding and deleting records internal to the array.

2653


What is main () in c language?

590