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

Diff.b/w Frames and container?

1 Answers   Tech Mahindra, Wipro,


1.what is the vesition managment.

0 Answers   IBM,


how to swap all the values without using temporary variable. tha values r a = 20, x=60 and p=2.

5 Answers   DST Global Solutions, iGate,


Need provab technical test questions

0 Answers  


which worker is involved in all the phases of SDLC?

1 Answers  


can u send some model papers how computer awareness questions are asked in goverment jobs(oriental insurance)to my mail id me.priyankapadma@rediff.com

0 Answers  


Binary tree?

1 Answers   Mascot,


What is Console Application? & The purpose Of Console Application? with description.

1 Answers  


what is best way to create a Thread class & why?

0 Answers  


Explain with examples any 2 features of OOPS.

0 Answers   Tavant Technologies, Verifone,


Why data bus is bidirectional and address bus is unidirectional?

4 Answers   Infosys, Wipro,


List and explain any five built in functions for Lists data type in python

1 Answers   Peerless,


Categories