63 826
Assignments Done
99,3%
Successfully Done
In August 2018

Answer to Question #14353 in C++ for kushagra kumar

Question #14353
accept a long integer from user and check whether square root of a number is prime or not.
Expert's answer
#include<stdio.h>
#include <conio.h>
#include <math.h>
int main()
{
int num ;
int sqrtnum;
printf("Enter the number: ");
scanf("%d",&num);
int i;

sqrtnum=pow(num,0.5);
for (i=2; i < sqrtnum ;i++ ){
int n = sqrtnum%i;
if (n==0){
printf("not Prime!");
break;
}
}
if(i == sqrtnum){
printf("Prime number!");
}
getch();
return 0;
}

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!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions