AI编程助手
AI免费问答

在C语言中编写一个打印正方形内嵌正方形的程序

王林   2023-09-02 08:09   1292浏览 转载

程序描述

按照下面所示的方式打印一个正方形内的另一个正方形

在C语言中编写一个打印正方形内嵌正方形的程序

算法

Accept the number of rows the outer Square to be drawn
Display the Outer Square with the number of rows specified by the User.
Display another square inside the outer square.

Example

的中文翻译为:

示例

/* Program to print Square inside Square */
#include <stdio.h>
int main()
{
   int r, c, rows;
   clrscr();
   printf("Enter the Number of rows to draw Square inside a Square: ");
   scanf("%d", &rows);
   printf("<p>");
   for (r = 1; r = 3 && r = 3 && c             </p>
<p>");
   }
   getch();
   return 0;
}</p></stdio.h>

输出

在C语言中编写一个打印正方形内嵌正方形的程序

13万字C语言保姆级教程(深入):立即学习
在学习笔记中,你将探索c语言的核心概念和高级技巧!

声明:本文转载于:tutorialspoint,如有侵犯,请联系admin@php.cn删除