C++ program Statements using Loops 
Here are some program statements which can be used as practice of Loops and also for assignment to students.

1.Write a program that accept input from user and display its factorial.(While 
Loop)
Example: 5! 1 X 2 X 3 X 4 X 5=120
2.Write a C++ program which take input from user and Show Maximum and Minimum number among them. Program terminate when user enter 0.
Sample output:
enter number:5
enter number:9
enter number:125
enter number:6
enter number:0
Maximum number=125
Minimum number=5
3. Write a program which takes number and length from user and print table of that number. e.g user enter num=2 and length=5 you have to print table of 2 up to 2X5=10.
4.Write a program which shows product of odd numbers between 1 to 100.
5.Write a program which Sum of 1 to 100 numbers divisible by 4.
6.Write a program which take number from user and show all dividers of that number.
7.Write a program which use For Loop to check number is Prime or Not.
8.Write a program which use while loop to show prime numbers between 2 to 100.
9.Write a program to enter 20 numbers and at the end it should display the count of positive, negative and zeros entered. (while Loop)
10.Write a program to calculate the sum of following series where n is input by user.
1 + 1/2 + 1/3 + 1/4 + 1/5 +…………1/n
11.Write a program using any loop which shows complete Ascii table and their values.
12.Write a Program which accept range from user and Print Sum of Even and Odd number between range.
13.Write a program which select a number randomly from 1 to 10 and ask user to guess that number and after each result confirm from user that he want to play more or not.(do While).hint use rand function for random numbers next Page
14.Print the pattern like shown below with loops , where the number of stars in first row rectangle is input by user
Example if no of stars are 11 in first rectangle
* - ***********
*** - *********
***** - *******
******* - *****
********* - ***
*********** - *
15.Print the pattern like shown below with any loop , where the X(variable) is input by user
Example if X is 6
*** ******
****** ***
*** ******
****** ***
*** ******
****** ***
C++ program Statements using Loops

0 comments:

Post a Comment

 
Top