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


Please Help Members By Posting Answers For Below Questions

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

2192


How can I do peek and poke in c?

622


How to write a code for reverse of string without using string functions?

1581


Why is structure padding done in c?

650


What are the 4 types of organizational structures?

626






Explain what is a pragma?

595


What does it mean when the linker says that _end is undefined?

637


What does 4d mean in c?

950


What is pointer in c?

743


Write a program to print all permutations of a given string.

645


What is NULL pointer?

678


What is substring in c?

642


Is main an identifier in c?

606


Explain what is the difference between a free-standing and a hosted environment?

636


Explain what is the difference between the expression '++a' and 'a++'?

628