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
shorting algorithmS
What is the difference between text files and binary files?
if the area was hit by a virus and so the decrease in the population because of death was x/3 and the migration from other places increased a population by 2x then annually it had so many ppl. find our the population in the starting.
write a C program: To search a file any word which starts with ?a?. If the word following this ?a? starts with a vowel.Then replace this ?a? with ?a? with ?an?. redirect with the output onto an output file.The source file and destination file are specified by the user int the command line.
how many errors in c explain deply
What is wrong in this statement?
Explain what are preprocessor directives?
Why header file is used in c?
What is the use of pragma in embedded c?
How does #define work?
How can I read in an object file and jump to locations in it?
#include
Explain 'bus error'?
Is c weakly typed?
How do I create a directory? How do I remove a directory (and its contents)?