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


Please Help Members By Posting Answers For Below Questions

What is the function of this pointer?

683


write a c program to find the sum of five entered numbers using an array named number

1624


What are pointers? What are stacks and queues?

585


a direct address that identifies a location by means of its displacement from a base address or segment a) absolute address b) relative address c) relative mode d) absolute mode

663


What is realloc in c?

585






When should the volatile modifier be used?

689


With the help of using classes, write a program to add two numbers.

624


Explain what is wrong with this program statement?

628


Is there a way to switch on strings?

623


hi... can anyone help me to make a two-dimensinal arrays in finding the sum of two elements plzzz. thnx a lot...

1453


What does s c mean in text?

623


How can I find out how much free space is available on disk?

634


Can we replace the struct function in tree syntax with a union?

790


What is a dynamic array in c?

601


What is a void pointer? When is a void pointer used?

636