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

Assignment-Level3

The document contains a series of programming tasks that involve basic operations such as printing multiplication tables, calculating sums and averages, printing patterns, and manipulating numbers. Each task includes sample outputs to illustrate the expected results. The tasks are designed to enhance programming skills through practical exercises.

Uploaded by

dhanaerol13
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Assignment-Level3

The document contains a series of programming tasks that involve basic operations such as printing multiplication tables, calculating sums and averages, printing patterns, and manipulating numbers. Each task includes sample outputs to illustrate the expected results. The tasks are designed to enhance programming skills through practical exercises.

Uploaded by

dhanaerol13
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Instruction: Please write your answer on paper and submit it by Monday.

1. Write a program that prints the multiplication table of a number.


Sample Output:
Enter a number: 5
5x1=5
5 x 2 = 10
5 x 3 = 15
5 x 4 = 20
5 x 5 = 25
5 x 6 = 30
5 x 7 = 35
5 x 8 = 40
5 x 9 = 45
5 x 10 = 50

2. Write a program that calculates the sum of numbers from 1 to 100 and display the average.
Output:
Sum = 5050
Average = 50.5

3. Write a program that prints all even numbers between 1 and 50.
Output:
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50

4. Write a program that prints the reverse of a given number.


Sample Output:
Enter a number: 1234
Reverse is 4321

5. Write a program that prints a pattern of stars in a right-angled triangle.


Output:
*
**
***
****
*****

6. Write a program that prints numbers from 1 to 10, but skips multiples of 3.
Output:
1, 2, 4, 5, 7, 8, 10

7. Write a program that calculates the sum of even numbers between 1 and 50.
Sum of even numbers: 650
8. Write a program that prints a countdown from 10 to 1.
Output:
10 9 8 7 6 5 4 3 2 1

9. Write a program that counts the number of digits in a given number.


Sample Output:
Enter a number of digits: 53678
Number of digits: 5

10. Write a program that prints a pattern of numbers in an inverted pyramid shape.
Sample output:
Enter a number: 5
12345
1234
123
12
1

11. Write a program that calculates and displays the sum of all numbers between two specified
numbers.
Enter 1st #: 2
Enter 2nd #: 8
Sum is 25

12. Write a program that prints a square of stars.


Enter a number: 4
****
****
****
****

13. Write a program that prints the sum of all digits of a given number.
Sample Output:
Enter a number: 12345
Sum is 15

14. Write a program that prints the odd numbers in a given number.
Sample output:
Enter a number: 34587
Odd numbers: 3, 5, 7

15. Write a program that prints the 5 numbers.


Sample output:
1. Enter a number: 2
2. Enter a number: 6
3. Enter a number: 8
4. Enter a number: 1
5. Enter a number: 0
Sum is 17

You might also like