正在加载图片...
源程序-判断数字的奇偶性#include<stdio.h>int main(void)I int number;printf("Entera number: ");scanf("%d", &number);Entera number: 1028Tnenumberiseven.if(number % 2 == 0)(printf("Tne number is even. In');1Entera number:329elsetTne numberis odd.printf("Tne number is odd. In");1此处条件内由于只有一条return o;语句,故可省略i1源程序-判断数字的奇偶性 #include <stdio.h> int main(void) { int number; printf("Enter a number: "); scanf("%d", &number); if(number % 2 == 0){ printf("Tne number is even. \n"); } else{ printf("Tne number is odd. \n"); } return 0; } Enter a number: 329 Tne number is odd. Enter a number: 1028 Tne number is even. 此处条件内由于只有一条 语句,故{ }可省略
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有