write a Program to dispaly upto 100 prime numbers(without
using Arrays,Pointer)

Answer Posted / sathya

#include<iostream.h>
void main()
{
int n,a;
cout<<"enter the limit";
cin>>n;
for(i=1;i<=n;i++}
{
if(i=1)
{
cout<<"1 is neither a prime nor a composite no";
}
else if(i%1==0|i%i==0)
{
cout<<i<<"is a prime number";
}
}
}

Is This Answer Correct ?    63 Yes 165 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When is the “void” keyword used in a function?

843


What are the 4 data types?

604


Explain union.

641


What is the difference between class and object in c?

585


How can I check whether a file exists? I want to warn the user if a requested input file is missing.

658






What are the various types of control structures in programming?

630


What header files do I need in order to define the standard library functions I use?

543


What are the types of functions in c?

577


What is pointer & why it is used?

607


What is mean by Data Driven framework in QTP? Can any one answer me in details on this regard.

1788


Explain what is a pragma?

596


What is volatile keyword in c?

587


What is array in C

713


How is a null pointer different from a dangling pointer?

560


Explain what is the stack?

638