write a Program to dispaly upto 100 prime numbers(without
using Arrays,Pointer)
Answer Posted / nachiyappan
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,c,n=1;
clrscr();
for(i=1;i<=100;i++)
{
n=n+1;
c=0;
for(j=1;j<=n;j++)
{
if(n%j==0)
c=c+1;
}
if(c==2)
printf("no. %d is prime",n);
else
printf("no. %d is not prime",n);
}
getch();
}
| Is This Answer Correct ? | 33 Yes | 11 No |
Post New Answer View All Answers
What is variable declaration and definition in c?
Explain pointers in c programming?
What is the sizeof () a pointer?
explain how do you use macro?
Explain spaghetti programming?
Why does notstrcat(string, "!");Work?
Hi can anyone tell what is a start up code?
if (i = 0)printf ("True"); elseprintf("False"); Under what conditions will the above print out the string "True" a) Never b) Always c) When the value of i is 0 d) all of the above
Explain the difference between strcpy() and memcpy() function?
what is a constant pointer in C
What is the significance of an algorithm to C programming?
Write a program of advanced Fibonacci series.
What is a union?
How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same
Difference between MAC vs. IP Addressing