مثال برمجي 6 : Write a program to display half pyramid using stars pattern
- 2020-10-29
توصيف
السؤال من كورس ال Programming الخاص بي
Write a program to display half pyramid using stars pattern.
*
* *
* * *
* * * *
* * * * *
الحل:
/**************************************************************************************************
Name : ex18.c
Author : Mohamed Elsayed
Description : Assignment 1 - Ex 18
**************************************************************************************************/
#include
int main()
{
int i, j, rows;
printf("Enter number of rows: ");
scanf("%d",&rows);
printf("\n");
/* Loop for each row */
for(i=1; i<=rows; ++i)
{
/* loop to display the stars in each row, number of stars in each row is same as number of rows */
for(j=1; j<=i; ++j)
{
printf("* ");
}
printf("\n");
}
return 0;
}
لمزيد من التفاصيل يرجى التواصل معي