练习2-3 输出倒三角图案 (5 分)

2-3 输出倒三角图案 (5 分)

本题要求编写程序,输出指定的由“*”组成的倒三角图案。

输入格式:

本题目没有输入。

输出格式:

按照下列格式输出由“*”组成的倒三角图案。

* * * *
 * * *
  * *
   *

#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {
printf("* * * *\n * * *\n * *\n *") ;
return 0;
}

原文地址:https://www.cnblogs.com/xxl-h/p/11110689.html

时间: 2024-08-30 11:19:19

练习2-3 输出倒三角图案 (5 分)的相关文章

IO-08. 输出倒三角图案(for循环写的不符合,用笨笨的println,%&gt;_&lt;%)

本题要求编写程序,输出指定的由“*”组成的倒三角图案. 输入格式:本题目没有输入. 输出格式:按照下列格式输出由“*”组成的倒三角图案. * * * * * * * * * *注意:严格按照下面截图的样式. 无奈用for循环写不出,只好用笨笨的println一行行的输出了. public class Main { public static void main(String[] args) { System.out.println("* * * *"); System.out.prin

浙大版《C语言程序设计(第3版)》题目集 练习2-3 输出倒三角图案 (5 分)

练习2-3 输出倒三角图案 (5 分) 本题要求编写程序,输出指定的由"*"组成的倒三角图案. 输入格式: 本题目没有输入. 输出格式: 按照下列格式输出由"*"组成的倒三角图案. * * * * * * * * * *思路:格式化输出,注意换行.代码如下: #include<stdio.h> int main () { printf("* * * *\n"); printf(" * * *\n"); printf

实验1-8 输出倒三角图案

package com.company; public class Main { public static void main(String[] args) { // write your code here System.out.println("* * * *"); System.out.println(" * * *"); System.out.println(" * *"); System.out.println(" *&qu

【DAY2】输出正三角和倒三角的实验

class Triangle2 { public static void main(String[] args){ int x,y; for(x=1;x<=5;x+=1){ for(y=1;y<=x+5;y+=1){ System.out.print("\t"); while(y==6-x){ System.out.print("*"); break; } } //System.out.print("\t"); System.out.

倒三角

实现倒三角的输出 public class a { public static void main(String[] args) { int i,j,k; for(i=0;i<4;i++) { for(k=0;k<=i;k++) { System.out.print(" "); } for(j=0;j<4-i;j++) { System.out.print("* "); } System.out.print("\n"); } }

jQuery 倒三角 正三角

智障啊! 今天脑抽了想写一个jQuery 倒三角锻炼自己,想了半天才有一点头绪. 研究结果如下: <script type="text/javascript"> $(function(){ var str = "*"; //正三角 for(i = 0;i < 5;i++){ for(j=0;j < i;j++){ document.write(str); } document.write("<br>"); }

Html 中select标签的边框与右侧倒三角的去除

首先是边框的去除:可以设置属性border:none;或border:0px; 不过这还是有一个bug,不同浏览器会在选中select标签时,加上一个边框: 之后是右侧倒三角的去除:设置属性 appearance:none; 以下所有属性兼容当前主流浏览器:appearance:none; -moz-appearance:none; -ms-appearance:none; -o-appearance:none; -webkit-appearance:none; (不过对与IE浏览器这个属性好像

用C# 实现正三角 倒三角 和乘法九九表

1.正三角: namespace zhengsanjiao { class Program { static void Main(string []arges) { for(int a=0;a<=10;a++)     //行数 { for(int b=0;b<=a;b++)   //个数 Console.Write(b); Console.WriteLine(); } } } } 2.倒三角: namespace daosanjiao { class Program { static voi

图形的正、倒三角

正三角 import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.print("请输入行数:"); int sum=input.nextInt(); for(int i=0;i<sum;i++){ for(int a=0;a<=i;a++){ System.out