⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 l14.1a

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 1A
字号:
#printUsing the familar "getnum.o" routinewrite a program that reads numbers one per line and determinesfor each if it is prime. Print "prime"for a prime number and "composite" for a non-prime number.Compile, test, and type "ready".#once #create Ref1003917947#once #create Ref1primecomposite#once cp %s/getnum.o .#usera.out <Ref >x1#cmp x1 Ref1#succeed/* A slow but sure prime-tester */main(){	int p, i, comp;	while ((p = getnum()) >= 0) {		comp = 0;		for (i = 2; i*i <= p; i++)			if (p%i == 0) {				comp = 1;				break;			}		if (comp)			printf("composite\n");		else			printf("prime\n");	}}#log#next15.1a 10

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -