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
What are register variables? What are the advantage of using register variables?
What is the meaning of typedef struct in c?
write a program for the normal snake games find in most of the mobiles.
What is the use of f in c?
Simplify the program segment if X = B then C ← true else C ← false
what is bit rate & baud rate? plz give wave forms
What is the use of pointers in C?
Why main is used in c?
Write a program to swap two numbers without using third variable in c?
Explain void pointer?
How to implement a packet in C
What is sizeof int?
What is self-referential structure in c programming?
What is far pointer in c?
What is a program flowchart and how does it help in writing a program?