rjps.net
当前位置:首页 >> 编写程序,输出10行的蛇形数字金字塔 >>

编写程序,输出10行的蛇形数字金字塔

clear for i=1 to 9 for j=1 to 2*i-1 step 1??i next?next

#include<stdio.h> #include<stdlib.h> main() { int i,j,k,a; printf("请输入层数:"); scanf("%d",&a); for(i=1;i<=a;i++) { for(k=1;k<=a-i;k++) printf(" "); for(j=1;j<=2*i-1;j++) { printf("%d",i); } printf("\n"); } system("pause"); } 这个是金字塔形的!!!

#include<stdio.h> void main() { int i=0,k=0; char x='A'; for(k=0;k<26;k++) { for(i=0;i<k;i++) printf("%c",x+i); for(i=k;i>=0;i--) printf("%c",x+i); puts(" "); } return; }

#include <stdio.h>void main(){ const int ta=9; int i,j,k; for(i=1;i<=ta;i++) { for(k=1;k<=ta-i;k++) printf(" "); for(j=1;j<=i;j++) printf("%d",j); for(j=i-1;j>0;j--) printf("%d",j); printf("\n"); }}

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

Private Sub Command1_Click() Dim i As Integer Dim j As Integer Dim s As String For i = 1 To 9 s = Space((9 - i) * 2) For j = -(i - 1) To i - 1 s = s & i - Abs(j) & " " Next Print s Next End Sub

Private Sub form_load() Dim I As Integer, J As Integer Form1.AutoRedraw = True For I = 1 To 5 Print Space(17 - 3 * I); For J = 1 To I If J 1 Then Print " "; Print Trim(Str(J)); Next For J = I - 1 To 1 Step -1 Print " "; Print Trim(Str(J)); Next Print Next Form1.ShowE穿讥扁客壮九憋循铂末nd Sub已经运行过了,有啥子问题请留言.

//参考#include<stdio.h> int main() { int i, j, num = 1; for (i = 0; i < 10; ++i){//第i层 for (j = 0; j < 2*(10-i)-1; ++j){//打印copy空格 printf (" "); } for (j = 0; j < i; ++j){//打印左半部分zd printf ("%d ", num); num++; } for (; j >= 0; --j){//打印右半部分 if (

所要的程序已经完成,请采纳:#includevoid main(){ int n,i,j; scanf("%d",&n); for(i=1;i

#include <iostream>using namespace std;int main(){ for(int i = 1; i <= 9; ++i) { for(int m = 1; m <= 9 - i; ++m) cout << " "; int j = 1; for(; j <= i; ++j) cout << j << " "; for(int k = i - 1; k >= 1; --k) cout << k << " "; cout << endl; } system("pause"); return 0;}

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