2021-05-15#pragma warning(disable : 4996)

/* prime1.c  It prompts the user to enter an integer N. It prints out
 *           if it is a prime or not. If not, it prints out a factor of N.
 */

#pragma warning(disable : 4996) 

 /*
 Visual Studio 库中的许多函数、成员函数、模板函数和全局变量已弃用。
 有些,例如 POSIX 和 Microsoft 特定的函数,因为它们现在具有不同的首选名称。
 某些 C 运行时库函数被弃用,因为它们不安全,并且具有更安全的变体。
 其他内容已被弃用,因为它们已过时。 弃用消息通常包含推荐的替代函数或全局变量。
 */

#include <stdio.h>

int main(void) {

	int input;
	printf("请输入要判断的整数:");
	scanf("%d", &input);
#pragma warning(default : 4996) 

	for (int i = 2; i*i < input; i++)
	{
		if (input % i == 0)
			printf("%d is not prime.\n", input);
		else printf("%d is  prime.\n", input);
		break;
	}

	getch();
	return 0;
}

猜你喜欢

转载自blog.csdn.net/weiabc/article/details/116866819
今日推荐