write a Program to dispaly upto 100 prime numbers(without
using Arrays,Pointer)
Answer Posted / prasad avunoori
int s=0;
int c,k;
for (int i = 2; i < 100; i++)
{
c = 0;
for (int j = 1; j <= i; j++)
{
if(i%j==0)
{
c = c + 1;
}
}
if (c == 2)
{
printf("%d\n",i);
s++;
}
} printf("There are %d " ,s);
Is This Answer Correct ? | 7 Yes | 2 No |
Post New Answer View All Answers
To print the pattern 1 2 3 4 5 10 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9
How can I do peek and poke in c?
How to write a code for reverse of string without using string functions?
Why is structure padding done in c?
What are the 4 types of organizational structures?
Explain what is a pragma?
What does it mean when the linker says that _end is undefined?
What does 4d mean in c?
What is pointer in c?
Write a program to print all permutations of a given string.
What is NULL pointer?
What is substring in c?
Is main an identifier in c?
Explain what is the difference between a free-standing and a hosted environment?
Explain what is the difference between the expression '++a' and 'a++'?