Go To The Editor: Expected Output
Go To The Editor: Expected Output
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
8. Write a program in C to display the n terms of odd natural number and their sum . Go
to the editor
Test Data
Input number of terms : 10
Expected Output :
The odd numbers are :1 3 5 7 9 11 13 15 17 19
The Sum of odd Natural Number upto 10 terms : 100
Click me to see the solution
9. Write a program in C to display the pattern like right angle triangle using an
asterisk. Go to the editor
10. Write a program in C to display the pattern like right angle triangle with a
number. Go to the editor
11. Write a program in C to make such a pattern like right angle triangle with a number
which will repeat a number in a row. Go to the editor
12. Write a program in C to make such a pattern like right angle triangle with number
increased by 1. Go to the editor
13. Write a program in C to make such a pattern like a pyramid with numbers increased
by 1. Go to the editor
1
2 3
4 5 6
7 8 9 10
Click me to see the solution
14. Write a program in C to make such a pattern like a pyramid with an asterisk. Go to
the editor
*
* *
* * *
* * * *
Click me to see the solution
16. Write a program in C to display the n terms of even natural number and their
sum. Go to the editor
Test Data :
Input number of terms : 5
Expected Output :
The even numbers are :2 4 6 8 10
The Sum of even Natural Number upto 5 terms : 30
Click me to see the solution
17. Write a program in C to make such a pattern like a pyramid with a number which will
repeat the number in the same row. Go to the editor
1
2 2
3 3 3
4 4 4 4
Click me to see the solution
19. Write a program in C to display the n terms of harmonic series and their sum. Go to
the editor
1 + 1/2 + 1/3 + 1/4 + 1/5 ... 1/n terms
Test Data :
Input the number of terms : 5
Expected Output :
1/1 + 1/2 + 1/3 + 1/4 + 1/5 +
Sum of Series upto 5 terms : 2.283334
Click me to see the solution
20. Write a program in C to display the pattern like a pyramid using asterisk and each
row contain an odd number of asterisks. Go to the editor
*
***
*****
Click me to see the solution
21. Write a program in C to display the sum of the series [ 9 + 99 + 999 + 9999 ...]. Go to
the editor
Test Data :
Input the number or terms :5
Expected Output :
9 99 999 9999 99999
The sum of the saries = 111105
Click me to see the solution
24. 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:
2
-8
32
-128
512
The sum = 410
Click me to see the solution
25. Write a program in C to display the n terms of square natural number and their
sum. Go to the editor
1 4 9 16 ... n Terms
Test Data :
Input the number of terms : 5
Expected Output :
The square natural upto 5 terms are :1 4 9 16 25
The Sum of Square Natural Number upto 5 terms = 55
Click me to see the solution
26. Write a program in C to find the sum of the series 1 +11 + 111 + 1111 + .. n
terms. Go to the editor
Test Data :
Input the number of terms : 5
Expected Output :
1 + 11 + 111 + 1111 + 11111
The Sum is : 12345
Click me to see the solution
28. Write a c program to find the perfect numbers within a given number of range. Go to
the editor
Test Data :
Input the starting range or number : 1
Input the ending range of number : 50
Expected Output :
The Perfect numbers within the given range : 6 28
Click me to see the solution
30. Write a C program to find the Armstrong number for a given range of number. Go to
the editor
Test Data :
Input starting number of range: 1
Input ending number of range : 1000
Expected Output :
Armstrong numbers in given range are: 1 153 370 371 407
Click me to see the solution
36. Write a program in C to display the such a pattern for n number of rows using a
number which will start with the number 1 and the first and a last number of each
row will be 1. Go to the editor
1
121
12321
Click me to see the solution
37. Write a program in C to display the number in reverse order. Go to the editor
Test Data :
Input a number: 12345
Expected Output :
The number in reverse order is : 54321
Click me to see the solution
38. Write a program in C to check whether a number is a palindrome or not. Go to
the editor
Test Data :
Input a number: 121
Expected Output :
121 is a palindrome number.
Click me to see the solution
39. Write a program in C to find the number and sum of all integer between 100 and 200
which are divisible by 9. Go to the editor
Expected Output :
Numbers between 100 and 200, divisible by 9 :
108 117 126 135 144 153 162 171 180 189 198
The sum : 1683
Click me to see the solution
40. Write a C Program to display the pattern like pyramid using the alphabet. Go to the
editor
A
A B A
A B C B A
A B C D C B A
Click me to see the solution
43. Write a C program to find HCF (Highest Common Factor) of two numbers. Go to the
editor
Test Data :
Input 1st number for HCF: 24
Input 2nd number for HCF: 28
Expected Output :
HCF of 24 and 28 is : 4
Click me to see the solution
44. Write a program in C to find LCM of any two numbers using HCF. Go to the editor
Test Data :
Input 1st number for LCM: 15
Input 2nd number for LCM: 20
Expected Output :
The LCM of 15 and 20 is : 60
Click me to see the solution
46. Write a program in C to convert a binary number into a decimal number using math
function. Go to the editor
Test Data :
Input the binary number :1010100
Expected Output :
The Binary Number : 1010100
The equivalent Decimal Number is : 84
Click me to see the solution
47. Write a C program to check whether a number is a Strong Number or not. Go to the
editor
Test Data :
Input a number to check whether it is Strong number: 15
Expected Output :
15 is not a Strong number.
Click me to see the solution
49. Write a c program to find out the sum of an A.P. series. Go to the editor
Test Data :
Input the starting number of the A.P. series: 1
Input the number of items for the A.P. series: 10
Input the common difference of A.P. series: 4
Expected Output :
The Sum of the A.P. series are :
1 + 5 + 9 + 13 + 17 + 21 + 25 + 29 + 33 + 37 = 190
Click me to see the solution
58. Write a C program to find the length of a string without using the library function. Go
to the editor
Test Data :
Input a string : welcome
Expected Output :
The string contains 7 number of characters.
So, the length of the string welcome is : 7
Click me to see the solution
1. Write a C program to accept two integers and check whether they are equal or
not. Go to the editor
Test Data : 15 15
Expected Output :
Number1 and Number2 are equal
Click me to see the solution
4. Write a C program to find whether a given year is a leap year or not. Go to the
editor
Test Data : 2016
Expected Output :
2016 is a leap year.
Click me to see the solution
6. Write a C program to read the value of an integer m and display the value of n
is 1 when m is larger than 0, 0 when m is 0 and -1 when m is less than 0. Go to
the editor
Test Data : -5
Expected Output :
The value of n = -1
Click me to see the solution
Test Data :
Input the marks obtained in Physics :65
Input the marks obtained in Chemistry :51
Input the marks obtained in Mathematics :72
Expected Output :
The candidate is eligible for admission.
Click me to see the solution
12. Write a C program to read roll no, name and marks of three subjects and
calculate the total, percentage and division. Go to the editor
Test Data :
Input the Roll Number of the student :784
Input the Name of the Student :James
Input the marks of Physics, Chemistry and Computer Application : 70 80 90
Expected Output :
Roll No : 784
Name of Student : James
Marks in Physics : 70
Marks in Chemistry : 80
Marks in Computer Application : 90
Total Marks = 240
Percentage = 80.00
Division = First
Click me to see the solution
13. Write a C program to read temperature in centigrade and display a
suitable message according to temperature state below : Go to the editor
Temp < 0 then Freezing weather
Temp 0-10 then Very Cold weather
Temp 10-20 then Cold weather
Temp 20-30 then Normal in Temp
Temp 30-40 then Its Hot
Temp >=40 then Its Very Hot
Test Data :
42
Expected Output :
Its very hot.
Click me to see the solution
Unit Charge/unit
If bill exceeds Rs. 400 then a surcharge of 15% will be charged and the minimum
bill should be of Rs. 100/-
Test Data :
1001
James
800
Expected Output :
Customer IDNO :1001
Customer Name :James
unit Consumed :800
Amount Charges @Rs. 2.00 per unit : 1600.00
Surchage Amount : 240.00
Net Amount Paid By the Customer : 1840.00
Grade Description
E Excellent
V Very Good
G Good
A Average
F Fail
Test Data :
Input the grade :A
Expected Output :
You have chosen : Average
Click me to see the solution
21. Write a program in C to read any day number in integer and display day
name in the word. Go to the editor
Test Data :
4
Expected Output :
Thursday
Click me to see the solution
22. Write a program in C to read any digit, display in the word. Go to the editor
Test Data :
4
Expected Output :
Four
Click me to see the solution
23. Write a program in C to read any Month Number in integer and display Month
name in the word. Go to the editor
Test Data :
4
Expected Output :
April
Click me to see the solution
24. Write a program in C to read any Month Number in integer and display the
number of days for this month. Go to the editor
Test Data :
7
Expected Output :
Month have 31 days
Click me to see the solution