Ad Code

NEW POST

6/recent/ticker-posts

HOW TO PRINT THIS PATTERN??11111,2222,333,44,5

 

OUTPUT:



CONCEPT:


TIMER:


UNDERSTAND THIS CODE IN 60 seconds.


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",j);

}

printf("\n");

}

getch();

}

Post a Comment

0 Comments