C problems
C problems
Expected Output:
1 2 3 4 5 6 7 8 9 10
*
**
***
****
*
**
***
****
8. Write a C program to make such a pattern like a pyramid with a number which will repeat the
number in the same row.
1
22
333
4444
9. Write a program in C to find the sum of the series [ 1-X^2/2!+X^4/4!- .........].
Test Data :
Expected Output :
Number of terms = 5
value of x = 2.000000
10. Write a program in C to display the n terms of a harmonic series and their sum.
Test Data :
Expected Output :
11. Write a program in C to display the sum of the series [ 9 + 99 + 999 + 9999 ...].
Test Data :
Input the number or terms :5
Expected Output :
9 99 999 9999 99999
The sum of the saries = 111105
12. Write a C program to check whether a given number is a 'Perfect' number or not.
Test Data :
Input the number : 56
Expected Output :
The positive divisor : 1 2 4 7 8 14 28
The sum of the divisor is : 64
So, the number is not perfect.
13. Write a C program to check whether a given number is an Armstrong number or not.
Test Data :
Input a number: 153
Expected Output :
153 is an Armstrong number.
16. Write a program in C to display the first n terms of the Fibonacci series.
Fibonacci series 0 1 2 3 5 8 13 .....
Test Data :
Input number of terms to display : 10
Expected Output :
Here is the Fibonacci series upto to 10 terms :
0 1 1 2 3 5 8 13 21 34