76 373
Assignments Done
Successfully Done
In May 2019

Answer to Question #23778 in C# for sheetal

Question #23778
write a program to accept a number and check whether its prime or not?
Expert's answer
# include<iostream.h>
# include<conio.h>

int isprime(int valuex)
int x,j;
for (j=2 ; j<valuex; j++)
{ if ((valuex%j)==0) x=0; }
if(x!=0) return 1;
& else return 0;

void main(){
int isprime(int);
int value;

cout<<"Enter a number to verify whether it is prime or not "<<endl;

if (isprime(value)==1) cout<<"Yes the number is prime"<<endl;
else cout<<"Sorry, not a prime"<<endl;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions