#include <stdio.h>
#include <math.h>
int main(){
int x;
printf("Enter The Number :");
scanf(" %d \n" , &x);
int xS= sqrt(x);
printf("Square Root of The Given Number : %d" , xS);
}
after entering the value 120
, nothing is happening! I am using Clion. What do I have to Do?
You should remove whitespace and '\n'
from the format string of scanf
.
An '\n' or any whitespace character in the format string of scanf consumes an entire sequence of whitespace characters in the input. So the scanf only returns when it encounters the next non-whitespace character, or the end of the input stream.