Wednesday, 20 March 2019

CP: Pattern Display :1

Que: Write a C program to display the following different Patterns.
1
1 2
1 2 3
1 2 3 4



Code:

#include <stdio.h>
int main()
{
    int i, j;

    for(i=1; i<=4; ++i)
    {
        for(j=1; j<=i; ++j)
        {
            printf("%d ",j);
        }
        printf("\n");
    }
    return 0;
}


Logic: 

No comments:

Post a Comment

LAB 7 Arduino with Seven Segment Display || Arduino Tutorial || Code and Circuit Diagram || Project

  LAB 7 Arduino with Seven Segment Display || Arduino Tutorial || Code and Circuit Diagram || Project Dear All We will learn how to Connec...