C - A3P1 - C Pattern #1



/*  Write a program for print the pattern
       * * * *
       * * * *
       * * * *
       * * * *
*/



#include<stdio.h>
#include<conio.h>
void main()
{
    int a,b,no;
    clrscr();
    printf("Enter Number - >");
    scanf("%d",&no);
    for(a=1;a<=no;a++)
    {
        for(b=1;b<=no;b++)
        {
            printf(" * ");
        }
        printf("\n");
    }
    getch();
}




1 comments :

1. Write a function in C called ShowStar. This function has the following features:
a. Input: an integer parameter called amount
b. Output: prints to standard output an X. This X is created using asterisks. It is
amount rows high and amount columns wide.
c. Returns: nothing
Example output:
If amount is 5, the function prints:
* *
* *
*
* *
* *
If amount is 6, the function prints:
* *
* *
**
**
* *
* *

Reply

Post a Comment