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

difference between native and cross compilers

1679


What is a char c?

599


write a c program for swapping two strings using pointer

2100


I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.

1502


How can you convert integers to binary or hexadecimal?

624






Explain is it better to bitshift a value than to multiply by 2?

724


Write a program to print ASCII code for a given digit.

692


How do we make a global variable accessible across files? Explain the extern keyword?

1428


What does do in c?

615


What is array in c with example?

625


What the different types of arrays in c?

618


What are the disadvantages of c language?

624


What is an endless loop?

814


What is a dynamic array in c?

601


Explain indirection?

652