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 / pravin

#include<iostream>
using namespace std;
int main()
{
int num,i,j,flag;
cout<<"enter the no. up2 which u want prime no's:";
cin>>num;
for(i=2;i<=num;i++)
{
flag=1;
for(j-2;j<i/2;i++)
{
if(i%j==0)
flag=0;
}
if(flag==1)
cout<<i<<" ";
}
}

Is This Answer Correct ?    34 Yes 22 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you list files in a directory?

1146


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.

1947


What is a static variable in c?

1129


What is the meaning of typedef struct in c?

1072


What is meant by keywords in c?

1070


Explain the concept and use of type void.

1117


WRITE A PROGRAM TO MERGE TWO SORTED ARRAY USING MERGE SORT TECHNIQUE..

2074


How can I recover the file name given an open stream?

1023


define string ?

1108


write a program to find out prime number using sieve case?

2099


What is file in c preprocessor?

1149


What is c system32 taskhostw exe?

1027


What standard functions are available to manipulate strings?

1155


What is the acronym for ansi?

1051


What is difference between static and global variable in c?

1056