Ad Code

NEW POST

6/recent/ticker-posts

HOW TO PRINT THIS PATTERN? 1,22,333,4444,55555 LEARN THIS CONCEPT IN JUST 1MIN

 OUTPUT:




TIMER:

UNDERSTAND THIS CODE 60 seconds.



CONCEPT:

first, take i and j loop respective to rows and columns and then define them where you want to number in the first loop(means i) and then to make a right-angle triangle here is the code:

for(i=1;i<=5;i++)

{

for(j=1;j<=i;j++)

{

            statement;

        }

}

and then print that variable.



C CODE(RUNS ON TURBO C++):

#include<stdio.h>

#include<conio.h>

void main()

{

int i,j;

clrscr();

for(i=1;i<=5;i++)

{

for(j=1;j<=i;j++)

{

printf("%d",i);

}

printf("\n");

}

getch();

}

Post a Comment

0 Comments