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

What is the size of a union variable?

1023


What are the various types of control structures in programming?

1026


The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?

1168


What is linear search?

1096


process by which one bit patten in to another by bit wise operation is? (a) masking, (b) pruning, (c) biting, (d) chopping,

2385


Explain the meaning of keyword 'extern' in a function declaration.

1133


What are c identifiers?

1060


Write a C program to help a HiFi’s Restaurant automate its breakfast billing system. Your assignment should implement the following items: a. Show the customer the different breakfast items offered by the HiFi’s Restaurant. b. Allow the customer to select more than one item from the menu. c. Calculate and print the bill to the customer. d. Produce a report to present your complete program and show more sample output. Assume that the HiFi’s Restaurant offers the following breakfast menu: Plain Egg $2.50 Bacon and Egg $3.45 Muffin $2.20 French Toast $2.95 Fruit Basket $3.45 Cereal $0.70 Coffee $1.50 Tea $1.80

3084


Why static variable is used in c?

1000


What is the use of getch ()?

1050


swap 2 numbers without using third variable?

1093


Why is sizeof () an operator and not a function?

993


FORMATTED INPUT/OUTPUT functions are a) scanf() and printf() b) gets() and puts() c) getchar() and putchar() d) all the above

1081


Explain how can I manipulate strings of multibyte characters?

1176


please send me the code for multiplying sparse matrix using c

2136