1 Answer - Sort by: Date | Rating
//Checking wheather a number is prime.
#include<iostream.h>
#include<conio.h>
void main(){
int number=0;
clrscr();
cout<<"Enter a number to check:";
cin>>number;
bool prime=true;
for(int i=2;i<number;i++){
if(number%i==0){
prime=false;
break;
}
}
if (prime)
cout<<"nEntered number is prime.";
else
cout<<"nEntered Number is not Prime.";
getch();
}
#include<iostream.h>
#include<conio.h>
void main(){
int number=0;
clrscr();
cout<<"Enter a number to check:";
cin>>number;
bool prime=true;
for(int i=2;i<number;i++){
if(number%i==0){
prime=false;
break;
}
}
if (prime)
cout<<"nEntered number is prime.";
else
cout<<"nEntered Number is not Prime.";
getch();
}
0
0
- Write A Program To Display The Pattern Like. * ** *** **** *****
- Write A Program To Find The Factorial Of 15?
- What Is The Input Electric On A Dsi?
- How To Make A C++ Program Of ATM?
- A C++ Program That Will Ask At Least 10 Information From The User And Display All The Information Inputted?
- What Are The Classified Input In Economists?
- What Are The Classified Input Had Economics?
- : Develop An Object Oriented Program In C++ To Read The Following Information From The Keyword In Which The Base Class Consists Of Employee Name, Code And Designation, And The Derived Class Containing The Data Members, Viz. Years Of Experience And Ag
- How Class Hierarchy Works?
- What Is Input Technologies Trends?
- What Are The Input Technologies?
- What Floods Include Weatherwise?
- Why Are Economists Input As Timeless?
- Why Do We Use Main() Function In C++?
- What Is An Example Of An Input Devise?
- How To Make A Simple Programming?
- Where Can I Learn DirectX Or OpenGL In C++?
- What Does |= And &= Means In C++?
- What Is Input From Technology Means?
- Write A Program In C/C++ To Implement Cohen-Sutherland Line Clipping Algorithm. In This Implementation, Consider Two Cases Of A Line: Totally Visible, Totally Invisible, Against The Rectangular Clipping Window?
- Can Somebody Tell Me Why This Code Will Not Compile: #include "Stdafx.h" //added This Include #include //added Stream To Io Using Namespace Std; Int Main() { //declare Variables Int Choice=0; Std::cout?
- Sample Program Which Requires 2 Numbers, Input 1 And Input Which Will Be The Start Of A Fibonacci Series?
- Sample Program Which Requires 2 Input For Fibonacci Series?
- Write A Program That Receives An Integer As Input And Outputs The Product Of Its Digits. E.g. 1234 = 24, 705 = 0, 478 = 224 Using C++?
- What Is Input Stream?
- How Do You Write A Program To Check Whether A No Is Prime Or Not?
- How To Write A Program In Turbo C?
- Write A Program For Finding That Given No. Is Prime No. Or Not.?
- How Do You Write A Program In C++ To Find The First 'N' Prime Numbers?
- How Can Write A Program To Find Prime Numbers?
- Write A Program To Find A Prime Number?
- How To Write A Program In C#(dotnet) For Checking Given Number Is Prime Or Not?
- How To Write A Program That Finds All Prime Palindromes Between Two Numbers A And B?

New Comment - Comments are editable for 5 min.