WAP to print all prime nos between 1 to 100 without using user
input...pls reply within few hours...



WAP to print all prime nos between 1 to 100 without using user input...pls reply within few hours...

Answer / ashwek

/// Using C++

#include<iostream.h>
#include<conio.h>

int main(){

int temp;

cout<<" Prime number between 1 to 100 : ";
for(int i=2; i<=100; i++){
temp=0;
for(int j=2; j<i; j++){
if(i%j==0) temp = 1;
}

if(temp==0) cout<<i <<", ";
}
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Programming Languages AllOther Interview Questions

4. What is the need of START 0? Instead if can we use any other numeric? If we use what will happen?

0 Answers   TCS,


1.Mutating table

0 Answers  


What is a dialog based program

1 Answers  


Define distributed queries. can you explain me as soon as possible

0 Answers   HCL,


how to generate dsnless connectivity in j2ee

0 Answers  






In JCl , we have COND parameter.This holds comparison code and condition.It also has only and even parameters. ex: COND((4,GE),EVEN).what the comma mean here. is that 'and' or 'or'.

0 Answers   L&T,


What is a singleton linked list?

1 Answers   Wipro,


hi i m deepak my shedule for NIC pi is 17 Apr please contact me if anybody has interview on same day or give me some idea who have faced

0 Answers  


i want to improve my english vocab for racking campus written exam plz tell me best book for prepration......

0 Answers  


Hi..Am done with my Masters recently..Am planning to learn TIBCO.. could anyone suggest me about how the job market will be and Is there any course necessary to learn prior to Tibco..i mean any prerequisite. I dnt have any knowledge on PL/SQL thats it... Plz suggest me in a best way...

0 Answers  


what are the advantages of sap on other software ?

0 Answers  


what are all the validation we need to perform in data stage?

0 Answers  


Categories