# 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;

}

#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 orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment