bycj.net
当前位置:首页 >> C语言编程 打印数字字符图案 输入任意整数n,输出n... >>

C语言编程 打印数字字符图案 输入任意整数n,输出n...

#include<stdio.h> int arr[10] = {0,1,2,3,4,5,6,7,8,9}; int main() { int line , i , j , k = 0 ; printf("Please input the amount of the lines:"); scanf("%d" , &line ); for( i = 0 ; i < line ; i++ ) { for( j = 0 ; j < i ; j ++ ) { printf(" "); } for( j = 0 ; j < line-i; j ++ ) { printf(

#include <stdio.h> int main() { int i,n; scanf("%d",&n); for(i=1;i<=n;++i) printf("%.*s\n",i,"***********************************"); return 0; }

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #include <stdio.h> int main(void){ int i,j,k,n; printf("Input n(int n>0)\nn="); if(scanf("%d",&n)!=1 || n<1){ printf("Input error, exit\n"); return 0; } for(j=1,i=0;j;++i<n ? j++ : j--){ for(k=0;k<

哈哈,我刚刚调试成功这道题,这是我课本上的一道练习题.本来想上网查查有没有更简单的答案的.还真查不着!程序怎么不可以是这样的?输入整数5 打印 A C F J O B E I N D H M G L K程序如下:main(){int i,j,n; char ch='A',ch1; printf("\nenter a number"); scanf("%d",&n); for(i=0;i 评论0 0 0

#include int main(void) { int n,i,j,t; scanf("%d",&n); for(t=i=0;i { for(j=0;j { if(j { printf(" "); } else { printf("%d",t++%10); } } printf("\n"); } return 0; }

源程序如下: #include <stdio.h> int main() { int n,i,j,sum=1,t; scanf("%d", &n); for(i=1;i<=n;i++) { t=1; for(j=1;j<=i;j++) { t *= 2; //每次计算2 ^ i 出来 } sum += t; //sum加上算出来的2 ^ i } printf("%d\n", sum); return 0; }

#include <stdio.h>#define SIZE 100 int main(void) { int num; int tmp; int i, j; char arr[SIZE][SIZE]; char (*p)[SIZE] = NULL; p = arr; p[0][0] = 0; printf("input numbers:"); scanf("%d", &num); for (i=1; i<num; i++) { tmp = p[0][0] + (i + 1)*i/2; if (1 == i)

public void printOut(int n){ for(int i = 0; i < n; i++ ){ for(int j = 0; j < 5; j++ ){ System.out.print("*"); } System.out.println(); }}

1 编程1.1 打印出以下图案** * ** * * * ** * * * * * ** * * * ** * **#includ

#include<stdio.h>void main(){ int n; scanf("%d", &n); for (int i = 1; i <= n; i++) { if (i <= n / 2 + 1) { for (int a = 1; a <= n / 2 + 1 - i; a++) { putchar(' '); }// putchar('\n'); for (int b = 1; b <= 2 * i - 1; b++) { putchar('*'); } putchar('\n'); } if (i>n / 2 + 1) { for (int a =

ddng.net | qhgj.net | gmcy.net | dzrs.net | xmlt.net | 网站首页 | 网站地图
All rights reserved Powered by www.bycj.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com