0% found this document useful (0 votes)
113 views

For Loop Assignments

The document contains 3 programming assignments: 1. Write loops to print different shapes like triangles and pyramids. 2. Write a program that takes number of rows as input and prints shapes of asterisks and letters. 3. Write a program that takes a name as input and prints it in the shape of a right triangle.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
113 views

For Loop Assignments

The document contains 3 programming assignments: 1. Write loops to print different shapes like triangles and pyramids. 2. Write a program that takes number of rows as input and prints shapes of asterisks and letters. 3. Write a program that takes a name as input and prints it in the shape of a right triangle.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignments

1. Create following shapes using for loop.


(a)
1
12
123
1234
(b)
1
121
12321
1234321
123454321
12345654321
123454321
1234321
12321
121
1
(c)
12345
234
3
234
12345
(D)
0
10
010
1010
01010
2. Write a program to enter number of rows and print following shapes.
*
*A*
*A*A*
*A*A*A*
*A*A*A*A*
*A*A*A*A*A*
*A*A*A*A*A*A*
*A*A*A*A*A*A*A*
*A*A*A*A*A*A*A*A*

|
*|*
**|**
***|***
****|****
3. Write a java program that asks for your name and then display it on a pattern resembling a right
triangle.
INPUT: A name (String)
OUTPUT: A right triangle drawn using the characters of the name (String) provided.
Sample Run 1:
Enter Your Name: GOOGLE
G
GO
GOO
GOOG
GOOGL
GOOGLE

You might also like