标签:crt while ret warning secure for循环 乘法口诀 tchar clu
分别用;
whlie循环嵌套 do-whlie循环嵌套 for循环嵌套
来做一个 99乘法口诀表
# define _CRT_SECURE_NO_WARNINGS #include <stdio.h> // whlie 循环嵌套 99乘法口诀表 int main() { printf(" 99乘法口诀表\n\n"); int i=1, j; while (i<=9) { j = 1; while (j<=i) { printf("%dx%d=%d\t",j,i,j*i); j++; } printf("\n"); i++; } getchar(); return 0; }
# define _CRT_SECURE_NO_WARNINGS #include <stdio.h> // do-whlie 循环嵌套 99乘法口诀表 // do-whlie 循环 是先执行在判断 int main() { printf(" 99乘法口诀表\n\n"); int i=1, j; do { j = 1; do { printf("%dx%d=%d\t", j, i, j*i); j++; } while (j<=i); printf("\n"); i++; } while (i <= 9); getchar(); return 0;
}
# define _CRT_SECURE_NO_WARNINGS #include <stdio.h> // for 循环嵌套 99乘法口诀表 int main() { printf(" 99乘法口诀表\n\n"); for (int i = 1; i <= 9; i++) { for (int j = 1; j <= i; j++) { printf("%dx%d=%d\t", j, i, i*j); } printf("\n"); } printf("\n"); getchar(); return 0; }
标签:crt while ret warning secure for循环 乘法口诀 tchar clu
原文地址:http://www.cnblogs.com/xuby/p/6511548.html