Fundamentals of Programming Lab Week 4 Page 1
Fundamentals of Programming
Lab Practical week 4
Task 1
Write a program that takes four digits integer from user and shows the digits on the
screen separately?
Task 2
Use for loop to print first 10 integers with tab space?
Task 3
Modify task 2? Write program that takes an integer input from user & display
number till that integer?
Task 4
Write program using while Loop and display following result
Number Square Cube
1 1 1
2 4 8
3 9 27
4 16 64
5 25 125
6 36 216
City University of Sciences and Technology Peshawar Furqan Nasir
Fundamentals of Programming Lab Week 4 Page 2
Task 5
Write a program using while loop that prints even number (from number 0-100)
Task 6
Modify program in task-5 and print first 50 odd numbers separately and even
numbers separately?
Task 7
Modify task 6 and produce sum of first 50 odd numbers from (0-100) and also
produce sum of first 50 even numbers (0-100)?
Task 8
Write a program that generate table of 2 using while loop?
Task 9
Modify Task 8 take input from user and generate table for number user has
requested?
Task 10
Modify task 9 take two inputs from user one for table & one for multiple of table and
produce results?
Task 11
Write program that produce first 10 integers in descending order?
City University of Sciences and Technology Peshawar Furqan Nasir
Fundamentals of Programming Lab Week 4 Page 3
Task 12
Modify task11 to produce factorial of a number entered by user?
Task 13
Write a program that produce following result
+*+*+*+*+*+*+*+*+*+*+*
Task 14
Write a program that produce following result
1234
5678
910 11 12
13 14 15 16
Task 14 b
Write a program that produce following result using nested for loop
1234
5678
9 10 11 12
13 14 15 16
City University of Sciences and Technology Peshawar Furqan Nasir
Fundamentals of Programming Lab Week 4 Page 4
Task 15
Write a program that produce following result
******
******
******
******
Hint: Use nested for loop to complete structure?
Task 16
Write a program that product following result
***********
***********
***********
***********
***********
***********
Hint: Use nested for loop to complete structure?
City University of Sciences and Technology Peshawar Furqan Nasir