[ create a new paste ] login | about

Link: http://codepad.org/E1zhWN6h    [ raw code | output | fork ]

C, pasted on Apr 26:
#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{

	int x;	// sqrt(4) = 2 ==> 4 là số chính phương
	// sqrt(5) = 2.333222 ==> 5 không là số chính phương

	printf("\nNhap vao x: ");
	scanf_s("%d", &x);

	if ((int)sqrt((float)x) == sqrt((float)x))
	{
		printf("\nLa so chinh phuong: ");
	}
	else
	{
		printf("\nKhong phai la so chinh phuong: ");
	}


	_getch();
	return 0;
}


Output:
1
Line 17: error: conio.h: No such file or directory


Create a new paste based on this one


Comments: