Zahoor Ahmad

 

Home

C/C++

TQM

Data Analysis

Statistics

Computer

Contact

 

Computer Programming (C & C++)-1564

Problems for Practice of Repetition Structures (Loops) :-

1

 

Calculate the sum of +ve odd integers for a given upper limit.

 

 

 

 

 

 

2

  Calculate the sum of even and odd integers separately for a given upper limit using only one loop structure.

 

   

 

   

3

 

Write a program to accept an integer and display its table.

 

   

4

  Write a program that read a number and prints its table in descending order.

 

   

 

 

5

  Write a program that prints all the odd positive integers less than 100.

6

  Write a program to prints the square of all the number from 1 to 10 as given below:
Number Square
1

2

3

.

.

.

10

1

4

9

.

.

.

100

 

     

7

  Write a program that finds and prints the product of the odd integers from 1 to 15.

 

   

8

 

Write a program to read in 25 numbers and compute the average, maximum and minimum values.

 

 

   

9

  Write a program to calculate the factorial of n. The value of n should be accepted through keyboard.

 

   

10

  Write a program to check whether the integer value, entered by the user, is a prime number?
     
11   Write a program that sum up the given series and print the result.
1+3+5+7+9+ ...... +99
     
12   Write a program that reads 15 numbers one by one and print the even numbers only.
     
13   Write a program that calculates sum of first 100 natural numbers by using for loop, and then check it with the help of formula.
     
14   Write a program that prints the following patterns separately. Use for loop to generate the patterns. All integers should be printed one at a time by a single cout statement in the loop.
(a) (b) (c) (d)

1

1  2

1  2  3

1  2  3  4

1  2  3  4  5

1  2  3  4  5

1  2  3  4

1  2  3

1  2

1

1  2  3  4  5

1  2  3  4

1  2  3

1  2

1

1

1  2

1  2  3

1  2  3  4

1  2  3  4  5

     
15   Write a program to print all the ASCll characters from 32 to 255.
     
16   Write a program to list first 50 prime numbers. i.e. 2, 3, 5, 7, 11, 13, so on.
     
17   Write a program to keep accepting some numbers and calculating their sum until 0 is entered. Also find average of all the numbers.
     
18   Write a program that reads two integers and prints their Greatest Common Divisor (GCD).
     
19   Write a program that estimates the value of ex by using the formula

     
20   Write a program that read any integer and finds its factorial using while loop.
     
21   Write a program that calculates and prints the average of marks of several students in the subject of C++. Assume the last value read is the sentinel 9999
     
     
22   Write a program that will generate a random number in the range 1 to 99. The user is to guess the number. Your program provides maximum 10 attempts to the user. The user inputs his/her guess. The program helps the user in such a way that it tells the user if the guess is larger or smaller than the number. In case of success the program displays "You have been succeeded" along with number of attempts made, other wise "Sorry you could not guess".
     
24   Write a program to find correlation coefficient and regression equation of y on x for n pair of values.
     
24   Write an entire C++ program that reads a positive integer entered by an interactive user and then prints out all the positive divisors of that integer.
     

 

 

The End

 



 

If you find any advertisement showing some indecent material please report its web address (URL) on contact page. It will help us to block such websites to show their ads in future. Sorry for inconvenience.