program in c programming language.
with recursive function.
Give a row of numbers and add those numbers in a triangle
example:
input:1 3 5 7
output:
1 3 5 7
4 8 12
12 20
32
Answers
Explanation:
with solution]
[An editor is available at the bottom of the page to write and execute the scripts.]
1. Write a program in C to display the first 10 natural numbers. Go to the editor
Expected Output :
1 2 3 4 5 6 7 8 9 10
Click me to see the solution
2. Write a C program to find the sum of first 10 natural numbers. Go to the editor
Expected Output :
The first 10 natural number is :
1 2 3 4 5 6 7 8 9 10
The Sum is : 55
Click me to see the solution
3. Write a program in C to display n terms of natural number and their sum.Go to the editor
Test Data : 7
Expected Output :
The first 7 natural number is :
1 2 3 4 5 6 7
The Sum of Natural Number upto 7 terms : 28
Click me to see the solution
4. Write a program in C to read 10 numbers from keyboard and find their sum and average. Go to the editor
Test Data :
Input the 10 numbers :
Number-1 :2
...
Number-10 :2
Expected Output :
The sum of 10 no is : 55
The Average is : 5.500000
Click me to see the solution
5. Write a program in C to display the cube of the number upto given an integer. Go to the editor
Test Data :
Input number of terms : 5
Expected Output :
Number is : 1 and cube of the 1 is :1
Number is : 2 and cube of the 2 is :8
Number is : 3 and cube of the 3 is :27
Number is : 4 and cube of the 4 is :64
Number is : 5 and cube of the 5 is :125
Click me to see the solution
6. Write a program in C to display the multiplication table of a given integer. Go to the editor
Test Data :
Input the number (Table to be calculated) : 15
Expected Output :
15 X 1 = 15
...
...
15 X 10 = 150
Click me to see the solution
7. Write a program in C to display the multipliaction table vertically from 1 to n. Go to the editor
Test Data :
Input upto the table number starting from 1 : 8
Expected Output :
Multiplication table from 1 to 8
1x1 = 1, 2x1 = 2, 3x1 = 3, 4x1 = 4, 5x1 = 5, 6x1 = 6, 7x1 = 7, 8x1 = 8
...
1x10 = 10, 2x10 = 20, 3x10 = 30, 4x10 = 40, 5x10 = 50, 6x10 = 60, 7x10 = 70, 8x10 = 80
Click me to see the solution
8. Write a program in C to