UCEST 105 Lab Cycle - 3
Learning Objective:
Learn to use RATOR tool
Learn to use nested control statements
RAPTOR programs to try
1.Check positive and negative number
2.Odd or Even Number using modulus (%) operator
3.Print 10, 9, 8, .... 1
4.Print sum of the digits of a number
5.Factorial of a given number
Nesting of Loops/control statements
Print the following patterns using nested loops.
1.Square Pattern:
* * * * *
* * * * *
* * * * *
* * * * *
2.Right-Angled Triangle Pattern:
*
* *
* * *
* * * *
* * * * *
3.Pyramid Pattern:
*
* * *
* * * * *
* * * * * * *
* * * * * * * * *
6.Pascals Triangle
7.Print all prime numbers less than 1000.( use nested for loops)
8.Print the multiplication table of numbers from 1-15 ( multiplication limit 10) ( use nested for)
9.Print the digit in words ( eg: 534 Five Three Four , use for loop and match-case )
10.Find the largest digit in a number( use while and if )
Learn to use RATOR tool
Learn to use nested control statements
RAPTOR programs to try
1.Check positive and negative number
2.Odd or Even Number using modulus (%) operator
3.Print 10, 9, 8, .... 1
4.Print sum of the digits of a number
5.Factorial of a given number
Nesting of Loops/control statements
Print the following patterns using nested loops.
1.Square Pattern:
* * * * *
* * * * *
* * * * *
* * * * *
2.Right-Angled Triangle Pattern:
*
* *
* * *
* * * *
* * * * *
3.Pyramid Pattern:
*
* * *
* * * * *
* * * * * * *
* * * * * * * * *
4.Number pattern ( read N; example with N=5 is shown)
5 4 3 2 1
4 3 2 1
3 2 1
2 1
1
4 3 2 1
3 2 1
2 1
1
5.Write a python program to generate the following type of pattern for the given N rows where N <= 26.(University Question)
A
A B
A B C
A B C D
A B C D E
A B
A B C
A B C D
A B C D E
n=0 1
n=1 1 1
n=2 1 2 1
n=3. 1 3 3 1
n=4 1 4 6 4 1
7.Print all prime numbers less than 1000.( use nested for loops)
8.Print the multiplication table of numbers from 1-15 ( multiplication limit 10) ( use nested for)
9.Print the digit in words ( eg: 534 Five Three Four , use for loop and match-case )
10.Find the largest digit in a number( use while and if )
11.A standard science experiment is to drop a ball and see how high it bounces.Once the “bounciness” of the ball has been determined, the ratio gives a bounciness index. For example, if a ball dropped from a height of 10 feet bounces 6 feet high, the index is 0.6, and the total distance traveled by the ball is 16 feet after one bounce. If the ball were to continue bouncing, the distance after two bounces would be 10 ft + 6 ft + 6 ft + 3.6 ft = 25.6 ft. Note that the distance traveled for each successive bounce is the distance to the floor plus 0.6 of that distance as the ball comes back up. Write a program that lets the user enter the initial height of the ball, bounciness index and the number of times the ball is allowed to continue bouncing. Output should be the totaldistance traveled by the ball.
Comments
Post a Comment