Question about Computers & Internet

1 Answer

C++ write a c++ program to check whether a numberis prime or not?

Posted by on

1 Answer

  • Level 2:

    An expert who has achieved level 2 by getting 100 points

    MVP:

    An expert that got 5 achievements.

    Novelist:

    An expert who has written 50 answers of more than 400 characters.

    Governor:

    An expert whose answer got voted for 20 times.

  • Expert
  • 142 Answers

#include<iostream.h>
#include<conio.h>
#include<process.h>
void main()
{
int num;
cout<<"\nEnter a number:";
cin>>num;
for(int i=2;i<num;i++)
if(num%2==0)
{
cout<<"\nThe number you have entered is not a prime number";
exit(0);
}
cout<<"\nThe number you have entered is a prime number";
return 0;
}






PLEASE DONT FORGET TO RATE
THANKS ANS REGARDS

Posted on Jun 09, 2008

  • Rohit Chadha
    Rohit Chadha Jun 09, 2008

    I think by mistake and typed two incorrect lines of code
    Please correct them and rest everything is the same:
    These are the correct ones. Sorry for the inconvenience


    for(int i=2;iif(num%i==0)


×

1 Suggested Answer

6ya6ya
  • 2 Answers

SOURCE: I have freestanding Series 8 dishwasher. Lately during the filling cycle water hammer is occurring. How can this be resolved

Hi,
a 6ya expert can help you resolve that issue over the phone in a minute or two.
best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.
the service is completely free and covers almost anything you can think of (from cars to computers, handyman, and even drones).
click here to download the app (for users in the US for now) and get all the help you need.
goodluck!

Posted on Jan 02, 2017

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

1 Answer

How many times do I have to ask?


You must contact AMAZON customer service by phone is the easy way, but following the instructions below will work as well.
How do you unsubscribe from Amazon Prime? To end your Amazon Prime membership or cancel your free trial:**Go to Manage Your Prime Membership.**Depending on whether you have a paid Amazon Prime membership or are on a free trial, do one of the following: To end a paid membership, click End membership, on the left-hand side of the page.

Jan 21, 2017 | Amazon Computers & Internet

2 Answers

Pump Priming Problems.


Oil suction filter may be clogged. Did you check it?

May 21, 2008 | 1992 Mercedes-Benz 190

1 Answer

How do I cancel Amazon prime?


To end your Amazon Prime membership or cancel your free trial:
  1. Go to Manage Your Prime Membership.
  2. Depending on whether you have a paid Amazon Prime membership or are on a free trial, do one of the following: To end a paid membership, click End membership, on the left-hand side of the page.

Amazon.co.uk Help: Cancel Your Amazon Prime Membership

https://www.amazon.co.uk/gp/help/customer/display.html?nodeId=200421650 How do cancel Amazon prime Google Search

Dec 14, 2016 | Amazon Computers & Internet

1 Answer

If you have Amazon Prime do you have Kindle Unlimited? If not - how much is Kindle unlimited


They are different programs. Prime has a loaner program for books. Check online for unlimited pricing.

Nov 22, 2016 | Amazon Tablets & eReaders

2 Answers

What am I paying for Prime Membership and what dates am I covered to? Thanks, butterflycw@aol.com


Hi
You don't mention it so I have assumed that you are referring to "Amazon Prime". This is £79 per year.
There is a free 30 day trial.
I cannot log into your account, but can advise that your payments will be 12 months apart, so worth checking when first was made, or whether you are still within trial period.
Cheers

Jan 12, 2015 | Computers & Internet

1 Answer

PLEASE CALL ME MY NUMBERIS 9046737035THE KEYS ON IT JUST STOP WORKING


Try to turn it off. If touch pad is inactive, then hold down power button until it shuts off. If it happens again after first or second boot I would advice to check/test Hard Drive and RAM

Aug 19, 2011 | Sylvania G-Netbook

1 Answer

C# code wite a program to accept a number from the user and display all the prime numbers fro zero up to the numbers entered by user?


#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,rem,prime,primchk=1,chk;
clrscr();
printf("\nEnter the limit\n");
scanf("%d",&n);
printf("\n\n\nThe prime numbers are\n");
printf("\n2\t3\t");
for(primchk=1;primchk<=n;primchk++)
{
for(i=2;i<primchk;i++)
{
if(primchk%i==0)
{
chk=1;
chk=0;
break;
}
if(i==primchk-1)
{
if(chk==0)
{
printf("%d\t",primchk);
chk=0;
}
}
}
}
getch();
}

May 20, 2009 | Computers & Internet

1 Answer

Write a c program to find the largest prime factor of a number


#include<stdio.h>
#include<conio.h>
void main()
{
int num,i=1,j,k;
clrscr();
printf("\nEnter a number:");
scanf("%d",&num);
while(i<=num)
{
k=0;
if(num%i==0)
{
j=1;
while(j<=i)
{
if(i%j==0)
k++; j++;
}
if(k==2)
printf("\n%d is a prime factor",i);
}
i++;
}
getch();
}

May 16, 2009 | Computers & Internet

Not finding what you are looking for?
Computers & Internet Logo

Related Topics:

66 people viewed this question

Ask a Question

Usually answered in minutes!

Top Computers & Internet Experts

Brian Sullivan
Brian Sullivan

Level 3 Expert

27725 Answers

kakima

Level 3 Expert

101516 Answers

David Payne
David Payne

Level 3 Expert

14160 Answers

Are you a Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...