write a Program to dispaly upto 100 prime numbers(without
using Arrays,Pointer)
Answer Posted / anshul
#include <stdio.h>
#include<conio.h>
void main()
{
int i,j,k;
for (i=1;i<=100;i++)
{
k=0;
for (j=1;j<i;j++)
{
if (i%j==0)
{
k++;
}
}
if(k==2)
{
printf("%d \n",i);
}
}
getch();
}
It displays all prime no. from 1 to 100
commants: er.anshul2009@gmail.com
| Is This Answer Correct ? | 4 Yes | 7 No |
Post New Answer View All Answers
Explain is it valid to address one element beyond the end of an array?
Write a c program to build a heap method using Pointer to function and pointer to structure ?
Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]
What is the difference between array and structure in c?
find the sum of two matrices and WAP for it.
What happens if you free a pointer twice?
can anyone suggest some site name..where i can get some good data structure puzzles???
How many levels of indirection in pointers can you have in a single declaration?
What is the use of #include in c?
What does s c mean on snapchat?
Explain what is the most efficient way to store flag values?
Can you please explain the difference between syntax vs logical error?
How many types of operator or there in c?
write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.
What is the purpose of macro in C language?