Accept 10 Integers From User and Print Their Average Value On The Screen Code

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

1.

Accept 10 integers from user and print their average value on the screen

Code:

Output:

---------------------------------------------------------------------------------------------------------------------

2. Print the following patterns using loop :

a.

**

***

****

Code:
Output:

b.

***

*****

***

Code:

Output:

c.
1010101

10101

101

d.

12

123

1234

12345

3. Write a program to find greatest common divisor (GCD) or highest common factor (HCF) of

given two numbers.

4. Take integer inputs from user until he/she presses q ( Ask to press q to quit after every

integer input ). Print average and product of all numbers.

5. Given a number count the total number of digits in a number and also find sum of digits of

the number.

6. To display the cube of the number upto given an integer. If the given integer is 5, then

display cube of 1 to 4.

7. Accept 20 numbers from user and display sum of only even numbers.

8. Ask user number of terms to be generated of a series.

generate numbers for the following series and find its addition

[9 + 99 + 999 + 9999+........]

9. Write a program in C to display the sum of the series [ 1+x+x^2/2!+x^3/3!+....]. Go to the

editor

Test Data :

Input the value of x :3

Input number of terms : 5


Expected Output :

The sum is : 16.375000

10. Write a program in C to find the sum of the series [ x - x^3 + x^5 + ......]. Go to the editor

Test Data :

Input the value of x :2

Input number of terms : 5

Expected Output :

The values of the series:

-8

32

-128

512

The sum = 410

You might also like