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

Lab No.6 Loops Task 1: Use For Loop

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

Lab No.6 Loops Task 1: Use For Loop

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

LAB NO.

6
Loops
Task 1: use for loop
Write a C++ program that takes table number ‘num’ and starting and ending values (start to end) in
main().

Pass these three arguments to function that prints the table as shown below;

Enter table number: 5

Enter starting value: 11

Enter ending value: 15

Your required table is

===========

5 * 11 = 55

5 * 12 = 60

5 * 13 = 65

5 * 14 = 70

5 * 15 = 75

===========

Task 2: any loop


Write a program which prints all the alphabets (A B…..Z , a,b…..z)and their ASCII values.

Task 3: any loop


Ask the user to enter any number between 0-255 and then check that whether the number is ASCII
value of any alphabet or not.

Task 4: any loop


Write a program which ask from user a character. If character is in lower case convert it into Upper case,
If in Upper case then convert it into lower case.
Task 5: use do while loop
Write a program in which the user continues to enter positive numbers until the user enters any
negative number. At the end your program displays the average of all numbers entered except of the
negative number.

Expected Output:

Task 6: use for loop


Write a program that will take 10 inputs from user and find maximum number.

Task 7: use while loop


Write a program that will take 10 inputs from user and find minimum number.

You might also like