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

Iam using Microsoft Visual Studio to create a system for mobile store I want to know how to calculate mobile price that the customer buy and how to reduce quantity from the data base that we have for mobile .And also how to calculate revnue for each mobile and revnue for the total mobile

0 Answers  


it is a language or tools?

0 Answers  


what do you meant by Platform-Independent in Java?

6 Answers   Persistent,


why you have to became a software developer?

2 Answers  


How to create a new dataset only duplicate observations in proc sort procedure?

0 Answers   Accenture,






how to study PHP my own? i reffered many sites.. but as being a fresher i couldnt follow those... which site will be the best one?

0 Answers  


When we have more than one main function in a program how does the compiler know the starting point of the program, i mean from which main the execution or compilation of the program begins?

2 Answers   247Customer,


what is meant by life cycle of a business

0 Answers   IBM,


how to invoke the macro in another macro?

1 Answers   Accenture,


what do you man by firmware

4 Answers  


which of the following is efficient in terms of space a. insertion sort b. quick sort c. selection d. both a and c

1 Answers   Hughes,


Write a shell program. Enter basic pay of an employee and calculate DA, HRA, Deduction, Gross pay and Net pay as follows: DA = 75 % of BASIC HRA = 10 % of BASIC DEDUCTION = 15 % of BASIC GROSS PAY = BASIC+DA+HRA NET PAY = GROSS PAY-DEDUCTION.

1 Answers   TCS,


Categories