Lets
Learn Programming Language
Basic
1. WAP to accept two numbers and print the sum of two numbers?
2. Accept five subject marks and print the average?
3. Ram basic salary is input through keyboard. His HRA is 50% of basic
salary and DA is 20 % of basic salary. Calculate the gross salary (Basic Salary
+ HRA + DA)?
4. Enter any 4 digits and print the sum of 4 digits?
5. WAP to swap two numbers.
6. WAP to swap two numbers without using third variable.
7. Enter any character and change the case of that character?
8. Write a C program to create function power and calculate the power
of any number.
For example:
Assume number = 5
Power = 3
Result = 5*5*5 = 125
9.
Write a program to reverse a number?
Enter-I=12345
Reverse-J=54321
10.
Write a program to convert temperature in farnehite to Celsius?
Formula of Celsius =
(f-32)*5/9
Farnehite = 9/5*C+32
Simple If Construct
11. Enter any number and display the day of week?
12. Enter any number and display the month?
13. Accept two numbers from a user and find the greatest of two?
14. Accept three numbers from a user and find the greatest of three?
15.
Write a program to accept a number and to find out whether the
number is divisible by 5 or not?
16.
Write a program to accept a year and find out whether the year is
leap year or not?
17.
Write a program to accept a number and display a message indicating
whether it is positive or negative number?
18. Enter any 4 digits and check if it is palindrome?
19. Accept age from a user and check the age, if the age is greater the
50 print OLD and if it is less then and equal to 50 it should print YOUNG.
Nest If Construct
1. Accept three numbers from a user and find the greatest of three?
If Construct with Logical Operators
1. Accept total sales and check if the sales is greater than 5000
commission is 12.5% and if sales is between 2000 and 5000 than the commission
is 12% and if the sales is between 500 and 2000 than commission should be 10%
otherwise no commission?
2.
Write a program to accept the book name and selling price and find
out the discount on selling price. If selling price is above 1000 discount is
of 20% and if selling price is between 800-1000 discount is 15% and if selling
price is less than 500 no discount is given?
Switch Case
1. Enter any number and display the day of week?
2. Enter any number and display the month?
Loops
1. Print the sum of first 100 natural numbers?
2. Print the sum of first n natural number. Where n is the number
entered by the user?
3. Display all palindrome numbers from 1 to 1000?
4. W.A.P to display number from 1 to 50. Five integers per line?
5.
Write a program to reverse a number?
Enter-I=12345
Reverse-J=54321
6. Outputs using loops
1
1
2 1
1
2 3 2 1
1 2
3 4 3
2 1
7.
Write a program of count down and display blast?
8.
Write a program to accept 10 number and display total number of odd
and even?
9.
Write a program to accept 20 number and find out how many are
divisible by 5, display count?
10.
Write a program to accept name, address and marks in 4 subjects and
find the average marks. Display name, address, marks. Repeat this for 5
students?
11.
Write a program to find out the highest of any ten numbers?
12. Write a program to find
factorial of number?
13.
Write a program to accept print the following patterns:
1.* 2. * * * * 3. * 4. * * * * 5. *
* * * * * * * * * * * *
* * * * * * * * * * * *
*
* * * * * * * * * * * *
* *
6.
* * *
* 7. * 8. * 9. *
* *
* * * *
* * *
* * * * * * * * * * *
* * * * * * * * * *
* * *
14. Write a program to print the following nested pyramid as:
* *** *** *
** ** ** **
*** * * ***
15. Write a program to print the following character pyramid as:
a b b b
b a b b
b b a b
b b b a
16. Write a program to print the following double number pyramid as:
1222
2122
2212
2221
17. Write a program to count the no. of occurrences of n's in a given
number range.
For example:
random numbers : 45,78,2,65,489,6,2,6,55,9
find out how many times the digit 2 repeat?
2's digit repeat 2 times.
18. Write a program to print
the following number character pyramid as:
1
21A
321AB
4321ABC
54321ABCD
19. Write a program to print the following number triangle as:
0
1 0 1
2 1 0 2 1
3 2 1 0 1 2 3
20. Write a program to print the following character number pyramid
as:
1
A B
2 3 4
C D E F
5 6 7 8 9
21. WAP to print Fibonacci numbers less than given user number?
22. Write a program to print the following number pyramid :
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
23. Write a program to print the following number pyramid as:
1 2 3 4 5
2 3 4 5
3 4 5
4 5
5
24. Write a program to print
the following number pyramid or Floyd triangle:
1
2 3
4 5 6
7 8 9 10
Single Dimensional Arrays
1. Enter any 10 numbers and display them?(using Arrays)
2. Enter any 10 numbers and print the sum of them? (using Arrays)
3. Enter any 10 numbers and check how many of them are even?
4. Enter any 10 numbers and check the lowest of all?
5. Enter any two strings and check them if they are equal of not?
6.
Write a program to find string entered by a user is a palindrome?
7.
Write a program to find length of string?
8.
Write a program to reverse a string?
9.
Write a program to find out a vowel in a string?
10.
Write a program to find character in a string?
11.
Write a program to find character in a string and replace it with
another?
12.
Write a program to accept a string and find the occurrence in a
string?
13.
Write a program to find words in a string?
14.
Write a program to print string in this format:
Jatinder
Jatinder
Singh
Jatinder Singh Randhawa
15.
Write a program to reverse
words in a string?
Enter- jatinder
singh randhawa
Reverse-
16.
Write a program to replace a word with new word?
17.
Write a program to concatenate two string?
Enter-jatinder
singh
Concatenate-jatinder singh
18.
Write a program to create jumble dance?
Enter-JaTiNdEr
Jumble-jAtInDeR
19. Write a program to accept
10 number and print it in reverse order?
20. WAP for searching minimum and
maximum number in ten numbers
21. WAP for counting the number of characters and words in a given
string
Two Dimensional Arrays
1. Enter any 2 matrix and add them?
2. Enter any 2 matrix and print the product?
3. Enter any number and print it in words?
4.
Write a program to accept the number and print in words format?
Enter-14
Words- one four
Functions
1. Print the sum of digits using recursion?
2. Write a program to swap two
numbers?
3. Write a program to generate Fibonacci series using recursion
method.
4. All above functions using functions.
No comments:
Post a Comment