Loops (pattern-5) ID-3461

Pattern 5 (Id-3461)
Given the value of ‘n’, develop an algorithm and write a C program to print the following pattern. When the value of ‘n’ is 5, the pattern will look as follows:
**$

**$**$

**$**$**$

**$**$**$**$

**$**$**$**$**$

Input Format

First line contains the value of ‘n’



Output Format
Print the pattern given in the question

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

Post a Comment

0 Comments