Computer Science, asked by ShanayaTrivedi, 11 months ago

Write a program to show the following pattern.
11
12 22
13 23 33
14 24 34 44
15 25 35 45 55
Please Help!!


VemugantiRahul: symbols are problem
VemugantiRahul: like & /
VemugantiRahul: < >
VemugantiRahul: letters appear automatically after a symbol
VemugantiRahul: ok then go on
UnknownDude: Why has every single comment of mine deleted?
VemugantiRahul: how would I know
UnknownDude: Rhetorical question, Rahul
VemugantiRahul: may b you have logged out of your account

Answers

Answered by VemugantiRahul
4
Hi there!
Here's the answer:

°•°•°•°<><><><<>><><><>°•°•°•°

The o/p should be:

11
12 22
13 23 33
14 24 34 44
15 25 35 45 55

°•°•°•°<><><><<>><><><>°•°•°•°

Step-1:
¶ Observe and find relation of pattern printing.
(i.e., What are the numbers to be printed)

--> Here, o/p has 5 lines and 5 columns.

•It can be observed that there are two digits in o/p which signifies column and row number.
Eg:
In first line , the no. is 11 (column=1& row=1)
In second line, the no.s to be printed are
12 (column No.= 1& Row No.=2) & 22( column = 2& row=2)

{So we can just print column no. & row no.}***

Step-2:
¶ Find relation of no. of numbers to be printed per line
{i.e,. How many times the loop of printing column and row no. has to be repeated for each line}

•Clearly, If we observe last no. in each line.
Eg:
11 in first line
22 in second, 33 in third....

{So when row no. and column no. are equal, we should stop printing row and column values.}***

°•°•°•°<><><><<>><><><>°•°•°•°

/* C-program to show o/p as in above */
#include<studio.h>
#include<conio.h>
int main(void)
//main function begins
{
// Variable declaration part
…int i,j;
//Loop start (use for loop)
/* Taking row no. as 'i' and column no. as 'j'.*/
…for(i=1 ; i<=5 ; i++)
……{
………for(j=1; j<=i ; j++)
……………printf("%d%d",j,i);
/* only one line inside second for loop, no need of extra '{' & '}' */
……}
…return 0;
} // main function ends

°•°•°•°<><><><<>><><><>°•°•°•°

(Here, I just used '…' to follow indentation)

;)
hope it helps
Comment if you need to clear anything
Answered by siddhartharao77
2

Here is a sample code for that program:

for i in range(1,6):

print()

for j in range(1,i + 1):

print(j*10 + i, end=" ")


Note: I have solved it in python because u didn't mentioned a particular programming language to solve.


Hope it helps!   ----- > Good luck!

Attachments:

VemugantiRahul: That has to be apecified
VemugantiRahul: in particular!
siddhartharao77: The user ain't mention that @unknowndude
VemugantiRahul: yup
Similar questions