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

why should i hire u

16 Answers   Google, Satyam,


what is the maximam caption size of lebel

1 Answers  


This is the portal and portlet interview question API: is JSR 168 API Server: is ibm web sphere portal server6.0 IDE: is RAD 7.0 Question:In normal struts what is the actionservlet? Ans:org.apache.struts.action.ActionServlet. But What is the actionservlet in strutsportlet?

1 Answers   CTS, IBM,


how to hide prompts

0 Answers  


how will you code the subfile which is in editing mode (multiple case subfile)?

0 Answers   Bank Of America,






hi i am jyoti i have done sap training in sd and master degree in economics have 2 year exp as enduser in (gdms)and 1 year as sd consultant.as contract basis now what i can do for getting job in it industry

0 Answers   HCL,


.net 2005 supports how many languages?

4 Answers  


What are events in smartforms?

0 Answers   Accenture,


how can we implement locks in plsql?

0 Answers  


What are two of your strengths that you will bring to our QA/testing team?

0 Answers  


Given a Binary Search Tree, write a program to print the kth smallest element without using any static/global variable. You can?t pass the value k to any function also.

0 Answers   Amazon,


what is web configuration file

0 Answers   HCL,


Categories