Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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();
printf(" no. 1 is neither a prime nor composite no.");
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("\n no. %d is prime",n);
else
printf("\n no. %d is not prime",n);
}
getch();
}

Is This Answer Correct ?    26 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

In C programming, what command or code can be used to determine if a number of odd or even?

1068


Explain why can’t constant values be used to define an array’s initial size?

1364


What are pointers? Why are they used?

1197


How do you redirect a standard stream?

1118


How is null defined in c?

1162


What is a pointer and how it is initialized?

1169


What is c programming structure?

1212


What are terms in math?

1061


Write a program to generate random numbers in c?

1110


Explain Basic concepts of C language?

1169


What could possibly be the problem if a valid function name such as tolower() is being reported by the C compiler as undefined?

1289


Why void main is used in c?

1062


What are the different types of linkage exist in c?

1036


What is a structural principle?

1177


How does normalization of huge pointer works?

1182