Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Topic: Basic C Programming

Assignment Questions
1. WAP to input the radius value of any circle through the keyboard and then find out its area.
2. WAP to find out the area of any rectangle. The length and breadth of the rectangle must be
inputted by the user.
3. WAP to find out the sum of first n natural numbers where n is inputted from the keyboard.
4. WAP to input the three sides of any triangle and then find out its area.
5. WAP to swap the values of two variables using a third variable.
6. WAP to swap the values of two variables without using a third variable.
7. WAP to find the sum of the individual digits of any inputted three-digit positive number.
8. WAP to enter the principal, time, and rate of interest. Calculate the simple interest.
9. WAP to convert Fahrenheit to Celsius.
10. WAP to convert Celsius to Fahrenheit.
11. WAP to find the average marks of any student by entering 5 subject marks.
12. WAP to calculate the gross salary of an employee by inputting the basic salary. DA is 45% and
HRA is 30% of the basic salary.
13. WAP to calculate hours, minutes, and seconds by inputting seconds as input. For example:
INPUT: Enter the time value in seconds: 3672
OUTPUT: 1 Hour 1 minute 12 seconds
14. WAP to calculate the KM and Meter value by inputting the distance value as meters. For
example: INPUT: Enter the distance value in meters: 2550
OUTPUT: 2 KMs 550 Meters
15. WAP to find out the largest between three numbers using Conditional operator.

Topic: Decision Making Statements in C

Assignment Questions

1. WAP to find out the largest between two inputted numbers.


2. WAP to check whether an inputted number is even or odd.
3. WAP to enter any character and then check whether the entered character is a vowel or not.
4. WAP to enter any character. If the entered character is in lowercase then convert it into upper
case and vice versa.
5. WAP to check whether a given year is a leap year or not.
6. WAP to input two numbers. Check whether the inputted numbers are equal or the first
number is greater than the second number or the second number is greater than the first
number. Use nested if-else statement in your program.
7. WAP to test whether any inputted number is positive or negative or equal to zero. Use nested
if-else statement in your program.
8. WAP to enter the marks of a student in three different subjects. Calculate the grade of the
student as per the following rules:
If average mark >= 90 then O grade
If average mark >= 80 and < 90 then E grade
If average mark >= 70 and < 80 then A grade
If average mark >= 60 and < 70 then B grade
If average mark >= 50 and < 60 then C grade
If average mark >= 40 and < 50 then D grade
If average mark < 40 then F grade
9. WAP to find out the smallest between three inputted numbers.
10. WAP to calculate the income tax as per the following rules:
If income is less than or equal to 150000 then no tax.
If income is in the range 150001 to 300000 then charge 10% tax
If income is in the range 300001 to 500000 then charge 20% tax
If income is above 500000 then charge 30% tax
11. WAP to enter the previous month and current month meter reading. Calculate the electric
bill amount as per the following rules:
Bill amount for the first 100 units is Rs 3.20 per unit. For the next 200 units, it is Rs 5.40 per
unit. For the remaining units, it is Rs 6 per unit.
12. Enter the three sides of a triangle. WAP to check whether those sides form a valid triangle or
not (triangle is valid if sum of the two sides is greater than the largest of the three sides).
13. WAP to calculate the roots of a quadratic equation.
14. WAP to check whether an inputted number is even or odd using switch statement.
15. WAP to enter any character and then check whether the entered character is a vowel or not
using switch statement.
16. WAP to enter a number from 1 to 7 and display the corresponding day of the week using
switch statement.
17. WAP to enter the marks of a student in three different subjects. Calculate the grade of the
student as per the following rules using switch statement.
If average mark >= 90 then O grade
If average mark >= 80 and < 90 then E grade
If average mark >= 70 and < 80 then A grade
If average mark >= 60 and < 70 then B grade
If average mark >= 50 and < 60 then C grade
If average mark >= 40 and < 50 then D grade
If average mark < 40 then F grade

Topic: Branching Statements in C

Assignment Questions

1. WAP to find out the sum of first 10 numbers.


2. WAP to calculate the sum of the numbers from m to n where m and n will be inputted by the
user.
3. WAP to print the multiplication table of any inputted number.
4. WAP to find out the factorial of any number.
5. WAP to find out the largest among 10 numbers using loop and conditional operator.
6. WAP to check whether an inputted number is a prime number or a composite number.
7. WAP to check whether an inputted number is a palindrome number or not.
8. WAP to check whether an inputted number is an Armstrong number or not.
9. WAP to enter a decimal number. Display the binary equivalent of this decimal number.
10. WAP to enter a binary number. Display the decimal equivalent of this binary number.
11. WAP to display the Fibonacci series up to the nth term.
12. WAP to find out the GCD of two numbers.
13. WAP to find out the sum of the following series:
1/1! + 1/2! + 1/3! + …………………….. + 1/n!
14. Write a menu driven program to implement a calculator.
Topic: Nested Loops in C

Assignment Questions

1. WAP to print the following pattern:


1
12
123
1234
12345
2. WAP to print the following pattern:
1
22
333
4444
55555
3. WAP to print the following pattern:
A
AB
ABC
ABCD
ABCDE
ABCDEF
4. WAP to print the following pattern:
1
121
12321
1234321
123454321
5. WAP to display all prime numbers within a given range.
6. WAP to display all palindrome numbers within a given range.
7. WAP to display all Armstrong numbers within a given range.
8. WAP to print all those numbers with in a given range which are divisible by sum of their
individual digits.
Topic: 1-D Array in C

Assignment Questions

1. WAP to find out the mean of n numbers using array.


2. WAP to find out the largest and smallest element of an array.
3. WAP to insert a new element at any desired location of a partially filled array.
4. WAP to delete an element from a given position of an array.
5. WAP to implement Linear search on an array.
6. WAP to implement Bubble sort.
7. WAP to reverse an array.
8. WAP to merge two arrays into a new array.
9. WAP to find out the second largest element of an array.
10. WAP to check whether an array of integers contains any duplicate element or not.

Topic: 2-D Array in C

Assignment Questions

1. WAP to add to matrices.


2. WAP to find out the transpose of any matrix.
3. WAP to find out the sum of the diagonal elements of any matrix.
4. WAP to find out the sum of each row and each column of a matrix
5. WAP to multiply two matrices.

Topic: User-defined Functions in C

Assignment Questions

1. WAP to find out the area of a circle using function.


2. WAP to calculate xn using function where x and n will be inputted by the user.
3. WAP to find out the largest among three numbers using function.
4. WAP to test whether a number is prime or composite using function.
5. WAP to find out the factorial of a number using recursion.
6. WAP to find out the GCD of two numbers using recursion.
7. WAP to print the Fibonacci series up to the nth term using recursion.
8. WAP to find out the sum of the digits of a number using recursion.

Topic: Array and User-defined Functions

Assignment Questions

1. WAP to find out the sum of the elements of an array using function.
2. WAP to find the largest element of an array using function.
3. WAP to implement Linear search using function.
4. WAP to implement bubble sort using function.
5. WAP to add two matrices using function.
6. WAP to add multiply matrices using function.

Topic: String

Assignment Questions

1. WAP to enter any string and then count how many characters are present in it.
2. WAP to convert the characters of any string to upper case without using any string library
function.
3. WAP to extract the first n characters of any string.
4. WAP to extract the last n characters of any string.
5. WAP to extract a substring from an inputted string. The position from which to start the
substring and the length of the substring will be inputted by the user.
6. WAP to find out the length of any string using a user-defined function XSTRLEN ().
7. WAP to copy the content of one string to another using a user-defined function XSTRCPY ().
8. WAP to concatenate one string at the end of another string using a user-defined function
XSTRCAT ().
9. WAP to compare to strings using a user-defined function XSTRCMP ().
Topic: Structure

Assignment Questions

1. WAP to define a structure BOOK having members as title, author name, no. of pages, and
price. Enter the details of a book and display them.
2. WAP to define a structure POINT having elements as Xco, and Yco. Enter two points and then
find out the distance between them.
3. WAP to define a structure EMPLOYEE having elements as name, empid, department, age, and
salary. Enter the details of 5 employees and display the details of each employee.
4. WAP to define a structure STUDENT having members as name, roll_ no, branch, and CGPA.
Enter the details of 5 students. Display the details of the student having the highest CGPA.
5. WAP to define a structure EMPLOYEE having elements as name, empid, department, age, and
salary. Enter the details of 5 employees. Display the details of those employees whose salary
is greater than the average salary value of all employees.
6. WAP to define a structure COMPLEX having members as real, and imag. Define a user-defined
function ADDCOMPLEX () which will receive two structure variables as its arguments and will
return a structure variable. The ADDCOMPLEX () will add two complex numbers.
7. WAP to define a structure DISTANCE having members as kms, and metres. Define a user-
defined function ADDDISTANCE () which will receive two structure variables as its arguments
and will return a structure variable. The ADDDISTANCE () will add two distance values.
8. WAP to define a structure TIME having members as hour, minute, and second. Define a user-
defined function ADDTIME () which will receive two structure variables as its arguments and
will return a structure variable. The ADDTIME () will add two different time values.

Topic: Dynamic Memory Allocation

Assignment Questions

1. WAP to allocate memory dynamically for an integer array of size 10. Enter the array elements
and display their sum.
2. WAP to allocate memory dynamically for an array. Find out the largest and smallest element
of the array.
3. WAP to allocate memory dynamically for an integer array. Check whether an inputted
element is present in this array or not.
4. WAP to allocate memory dynamically for a character array. Store your first name in the
allocated memory. Now reallocate the memory using realloc () to store your entire name and
then display it.

Topic: File Handling, Command Line Arguments

Assignment Questions

1. WAP to count the number of characters, words, blank spaces, and tabs from a text file.
2. WAP to copy the content of one file to another file.
3. WAP to convert the characters of a file from lower case to upper case and vice versa.

4. Write a program to read and display the content of a file using command line argument.
5. WAP to copy the content of one file to another file. Both source file name and target file name
must be passed from the command prompt.
6. WAP to find out the sum of 5 integers passed from the command prompt.
7. WAP to pass your full name from the command prompt and then display it.

You might also like