You are on page 1of 16

WEEK-1

Programs on Basic data types

1. Write a C Program to find sum of 2 integer numbers.


2. Write a C Program to find subtract of 1integer 1float numbers.
3. Write a C program to find product of 2 float numbers.
4. Write a C program to find volume of a cube
5. Write a C Program to find sum of 1 integer 1 float numbers
6. Write a C Program to find subtract of two integer numbers.
7. Write a C program to find average of 2 float numbers.
8. Write a C Program to find s=ut+ 1/2at2
9. Write a C Program to find sum of 2 float numbers.
10. Write a C Program to find subtract of 2 float numbers.
11. Write a C Program to find product of 2 integer numbers.
12. Write a C Program to Swap two Numbers Using Temporary Variable
13. Write a C program to find product of 1 integer and 1float numbers.
14. Write a C program to find division of 1 integer 1 float numbers.
15. Write a C program to find average of 2 integer numbers.
16. Write a C program to find surface area of a sphere
17. Write a C program to find division of 2 float numbers.
18. Write a C program to find division of 2 integer numbers.
19. Write a C program to find average of (1int,1float) numbers.
20. Write a C Program to Swap Numbers without Using Temporary Variable
WEEK-2
Programs on Basic data types and to implement simple formulas

1. Write a C program to find the gross salary of the employee.


(read Basic, Da,Hra and pf is 10% of the basic)
2. Write a C program to convert temperature from Fahrenheit to Celsius and vice versa
(c=(fh-32)/1.8 and f=(c*1.8)+32
3. Write a C program to find area and perimeter of a circle.
(area=∏r2 perimeter=2∏r)
4. What is least number must be added to x to obtain a number exactly divisible by y.
(find rem=x%y
Subtract remainder from y, the answer will be least number must be added)
5. What is the least number must be subtracted from x to get the number exactly divisible by
y.
(Find remainder x%y and remainder is the least number must be subtracted)
6. Write a C program to calculate area and perimeter of a right angled triangle.
(Area=1/2*b*h perimeter=w+h+sqrt(w*w+h*h)
7. On dividing x by a certain number, the quotient is y and the remainder is z. Write a C
program to find the number.
(Number=x-z/y)
8. Find the sum of natural numbers 1 to n.(read n as input)
(Use formula sum=n(n+1)/2
9. Write a C program to calculate Simple interest (SI=PTR/100)
10. Write a C program to calculate area and perimeter of a rectangle.
Area=l*b
Perimeter=2* (l+b)
11. Write a C program to convert centimeters to meters and meters to kilometers.
(1 meter=100 centimeters 1 kilometer=1000 meters)
12. Write a C program to convert the given numbers of days into years, months and days.
(Years = days/365;   //Ignoring leap year
     Weeks = (days%365)/7;
     Days = days- ((years*365) + (weeks*7));

13. Write a C program to calculate the angle of a rectangle if two angle are given as input.
(a+b+c=180)
14. Write a C program to read the consumer number and number of units consumed and the
cost per unit and print the amount to be paid.
(Amt=num of units*cost)
15. Write a C program to find addition of two numbers using subtraction operator.
Sum=a-(-b)
16. Write a C program to read a character, and two integer numbers and print the ASCII
value of the given character, find quotient and remainder of two given integer numbers.
17. Write a C Program to calculate area and perimeter of a triangle.
Perimeter=(a+b+c)
s=(a+b+c)/2
Area=sqrt(s*(s-a)(s-b)*(s-c))
18. Write a C program to
19. read five Subject marks and find the average.

20. Write a C Write a program to read the values of x, y and z and print the results of
the following expressions in one line.

1. (x+y+z) / (x-y-z)

2. (x+y+z) / 3

3. (x+y) * (x-y) * (y-z)

21. Write a C program to Calculate Compound interest (CI=p(1+r/100)n


WEEK-3
Programs on if-else statements
1. Write a C program to find the given number is even or odd.
2. Write a C program to find largest of the three given number.
3. Write a C program to find whether given number is positive or negative or zero.
4. Write a C program to find all roots (real and equal, imaginary, equal roots of a quadratic
equation).
5. Write a C program to find the given two numbers are equal or less than the other or
greater than the other.
6. Write a C program to find the whether the given number is divisible by 5 or not.
7. Write a C program to whether given year leap year or not.
8. Write a program to read three integer values from the keyboard and displays the output
stating that they are the sides of right-angled triangle
x=a*a and y=b*b and z=c*c
if(a>b&&a>c&&(x==y+ z)) or if(b>a&&b>c&&(y== x+ z)) or
if(c>a&&c>b&&z==x+y)
9. Write a C program to find whether the person is eligible to vote or not
10. Write a C program to check whether given character is alphabet, digit or special
character.
11. Write a C program to check whether given number is divisible by 5 and 11 or not.
12. An electricity board charges the following rates for the use of electricity:
For the first 200 units: 80 per unit
For the next 100 units: 90per unit
Beyond 300 units: Rs.1.00 per unit
All users are charged a minimum of Rs. 100 as meter charge. If the total amount is more
than Rs.400, then an additional surcharge of 15% of total amount is charged. Write a
program to read the name of user and number of units consumed and print out the charges
with names.
13. Write a C program to find the smallest the three given numbers.
14. Write a C program to check whether triangle is valid or not if angles are given.
15. Write a C program to check whether given character vowel or constant
16. Admission to a professional course is subjects to the following conditions:
(a) Marks in Mathematics>=60
(b) Marks in Physics>=50
(c) Marks in Chemistry>=40
(d) Total in all three subjects>=200 or Total in Mathematics and Physics>=150
Given the marks in the three subjects, write a program to process the applications to list
the eligible candidates.
17. Write a C program to find whether given number is even or odd without using else
18. Write a C program to find whether given triangle is scalene or isosceles or equilateral.
19. Write a C program to grades of a student if the marks are given between 0 and 100.
20. A set of two linear equations with two unknowns x1 and x2 is given below: ax1 +bx2=m
and cx1+dx2=n The set has unique solution x1 and x2 provided the determinate ad-cb is
not equal to zero. Write a program that will read the values of constants a,b,c,d,m and n
and compute the values of x1 and x2 .The message ”the value is infinity” should be
printed if ad-cb=0.
x1=(m*d-b*n)/(a*d-c*b); x2=(n*a-m*c)/(a*d-c*b);
WEEK-4
Programs on repetitive statements

1. Write a C program to find the factorial of a given integer


2. Write a C program to find the sum of individual digits of a given integer.
3. Write a C program to find the LCM of two given numbers.
4. Write a C program to find the GCD of two given numbers.
5. Write a C program to check whether given number is Armstrong or not
6. Write a C program to print the characters from A to Z using loop.
7. Write a C program to count number of digits in a given integer.
8. Write a C program to find to check whether given number is prime or not
9. Write a C program to find to display the factors of a given number
10. Write a C program to find to reverse a given integer.
11. Write a C program to print the Fibonacci sequence up to given value of n.
12. Write a C program to print the multiplication table to the given value of n.
13. Write a C program to check whether given number is palindrome or not
14. Write a C program to check whether given number is perfect or not
15. Write a C program to print the prime numbers between 1 and n.
WEEK-5
Programs on repetitive statements

1. Write a C Program to find the Sum of Series sum=1 + 1/2 + 1/3 + 1/4 + … + 1/N.
2. Write a C program to generate the pattern
*
* *
* * *

3. Write a C program to find the sum of the series sum=1+2+4+6+8+10+ ….+N


4. Write a C program to generate the pattern
*****
****
***
**
*
5. Write a C program to generate Pascal's triangle
1
1 1
1 2 1
1 3 3 1
6. Write a C Program to find the Sum of Series SUM=1-x2/2! +x4/4!-x6/6!+x8/8!-x10/10!
7. Write a C program to generate pyramid of numbers.
1
1 3 1
1 3 5 3 1

8. Write a C Program to find the Sum of Series sum=1 + x+x2+x3+x4+……….+xn


9. Write a C program to generate pyramid of numbers.

1
1 2
1 2 3
1 2 3 4

10. Write a C Program to find the Sum of Series sum=1 + 1/2! + 1/3! + 1/4 !+ … + 1/N!.
11. Write a C program to generate pattern.

1
232
34543
4567654
567898765
12. Write a C Program to find the sum of series 1^2 + 2^2 + …. + n^2.
13. Write a C program to generate pattern
*
*A*
*A*A*
*A*A*A*

14. Write a C Program to find the sum of series sum=1^3 + 2^3 + …. + n^3

15. Write a C Program to find the sum of series sum=1/2-3/4+5/6-7/8........up to nth term
WEEK-6
Programs on 1-D Arrays
1. Write a C program to print the repeated elements with frequency count in an
array.
2. Write a C Program to find largest and smallest element in an array.
3. Write a C Program to find the number of non repeated elements in an array.
4. Write a C Program to find 2nd largest and 2nd smallest element in an array.
5. Write a C Program to put odd and even elements of given arrays into two separate
arrays.
6. Write a C Program to find sum and average of all elements in an array.
7. Write a C Program to copy the elements of one array to another array.
8. Write a C Program to merge two arrays into third array
9. Write a C Program to search for an element in the given array.
10. Write a C Program to insert an element in a specified position in the given array.
11. Write a C Program to delete specific element from the given array.
12. Write a C Program to cyclically permute the elements of the array.
13. Write a C Program to sort the elements of the array.
14. Write a C Program to swap every pair of elements in the given array.
15. Write a C program to calculate the fraction of positive numbers, negative numbers
and zeros in the given array.
WEEK-7
Programs on 2-D Arrays
1. Write a C Program to print diagonal elements of given matrix
2. Write a C Program to find transpose of a given matrix.
3. Write a C Program to find whether given matrix is symmetric or not.
4. Write a C Program to calculate the sum of elements of each row in given matrix
using functions.
5. Write a C Program to calculate the sum of elements of each column in given
matrix using functions.
6. Write a C program to find sum of main and opposite diagonal elements of a
matrix using functions.
7. Write a C program to print lower triangular matrix
8. Write a C program to print upper triangular matrix
9. Write a C Program to find multiplication of two matrices.
10. Write a C Program to find addition of two matrices using functions.
11. Write a C Program to find subtraction of two matrices using functions.
12. Write a C Program to check whether two given matrices are equal or not.
13. Write a C Program to check whether given matrix is identity matrix or not.
14. Write a C program to find trace and normal of a given matrix.
15. Write a C program to interchange two diagonals of a given matrix.
WEEK-8
Programs on non recursive functions

1. Write a C Program to find factorial of a given number using non recursive


functions.
2. Write a C Program to find binary equivalent of a given decimal number using non
recursive functions.
3. Write a C Program to co primes between 1 and 1000 using non recursive
functions.
4. Write a C Program to find HCF of 2 given numbers using non recursive functions.
5. Write a C Program to print sum of digits using non recursive functions.
6. Write a C Program to find GCD of 3 given numbers using non recursive
functions.
7. Write a C Program to find LCM of 3 given numbers using non recursive
functions.
8. Write a C Program to find the power of a given number using non recursive
functions.
9. Write a C program to find sum of natural numbers using non recursive function.
10. Write a C program to reverse a given integer number using non recursive
functions.
11. Write a C program to find twin primes between 1 and 1000 using non recursive
functions.
12. Write a C program to convert octal number to decimal number using non
recursion
13. Write a C program to print n Fibonacci terms using non recursion.
14. Write a C program to find sum of all even or odd numbers in given range using
non recursion.
15. Write a C program to print all strong numbers between 1 and n using non
recursion
WEEK-9
Programs on recursion

1. Write a C Program to find LCM of 3 given numbers using recursive functions.


2. Write a C program to reverse a given integer number using recursive functions.
3. Write a C program to find sum of natural numbers using recursive function.
4. Write a C Program to find the power of a given number using recursive functions.
5. Write a C program to find twin primes between 1 and 1000 using recursion.
6. Write a C Program to find HCF of 2 given numbers using recursive functions.
7. Write a C program to print all strong numbers between 1 and n using recursion functions.
8. Write a C program to convert octal number to decimal number using recursion
9. Write a C program to find co primes between 1 and 1000 using recursion.
10. Write a C Program to find binary equivalent of a given decimal number using recursive
functions.
11. Write a C Program to find factorial of a given number using recursive functions.
12. Write a C program to find sum of all even or odd numbers in given range using recursion.
13. Write a C Program to print Fibonacci sequence using recursive functions.
14. Write a C Program to find GCD of 3 given numbers using recursive functions.
15. Write a C Program to print sum of digits using recursive functions.
WEEK-10
Programs on Strings

1. Write a C Program to insert a sub string into main string at a given position.
2. Write a C Program to delete n characters from given string from the given
position.
3. Write a C Program to check whether given string is palindrome or not.
4. Write a C Program to check the sub string is present in the main string or not. If it
present return the position otherwise return -1 .
5. Write a C program to count number of vowels, consonants, digits and special
characters in a given string.
6. Write a C program to check two strings are equal or not without using strcmp()
function
7. Write a C program to concatenate two strings without using strcat() function.
8. Write a C program to find the length of the given string without using built in
function.
9. Write a C program to replace lowercase characters by uppercase and uppercase
characters by lowercase in the given string.
10. Write a C program to count number of lines, words and characters in the given
text.
11. Write a C Program to remove all Characters in a String except alphabet.
12. Write a C Program for Return maximum occurring character in the input string.
13. Write a C Program for Print reverse of a string using recursion.
14. Write a C Program to reverse words in a given string.
15. Write a C program to copy the content of one string to another without using
strcpy() function.
WEEK-11
Programs on Pointers and Structures

1. Write a C program to read the elements of 1-d array using pointers and print them in
reverse order using pointers.
2. Write a C Program to read two elements dynamically using malloc() function and
interchange the two numbers using call by reference.
3. Write a C Program to read and print the elements of 1-D array using calloc() memory
allocation function and reallocate memory for the array by increasing the size of the
array, read and print the elements of reallocated array.
4. Write a C Program to read and print elements of 1-D array using calloc() memory
allocation function.
5. Write a C Program to print 2-D array using pointers.
6. Write a C program to store name, roll number, year and marks of three subjects of n
students and print the student the name, roll number, average and grade based on average
marks of the student using structures.
7. Write a C Program to read real and imaginary parts of a complex number using structures
and perform the following operations on complex numbers.
Add two complex numbers.
Multiply two complex numbers.
Subtract two complex numbers.
8. Write a C Program to read time in hours, minutes, seconds using structures and perform
the following operations on time.
Addition of two time periods
Subtraction of two time periods
9. Write a C Program to read distance in inches and feet using structures and perform the
following operations
Add two distances
Subtract two distances
10. Write a C program to read employee details employee number, employee name, basic
salary, hra and da of n employees using structures and print employee number, employee
name and gross salary of n employees.
11. Write C program that can be used to read item details used in party and calculate all
expenses, divide expenses in all friends equally using structures.
12. Write a C Program to Create a structure to specify data on students given below: Roll
number, Name, Department, Course, Year of joining
(a) Write a function to print names of all students who joined in a particular year.
(b) Write a function to print the data of a student whose roll number is given.
13. Write a C Program to Create a structure to specify data of customers in a bank. The data to
be stored is: Account number, Name, Balance in account.
(a) Write a function to print the Account number and name of each customer with balance
below Rs. 100.
(b) If a customer request for withdrawal or deposit, it is given in the form: Acct. no, amount,
code (1 for deposit, 0 for withdrawal)
14. There is a structure called employee that holds information like employee code, name, date
of joining. Write a C Program to create an array of the structure and enter some data into it.
Then ask the user to enter current date. Display the names of those employees whose tenure
is 3 or more than 3 years according to the given current date.
15. Write a C Program that compares two given dates. To store date use structure say date that
contains three members namely date, month and year. If the dates are equal then display
message as "Equal" otherwise "Unequal".
WEEK-12
Programs on Files

1. Write a C program to read and print the content of a file.


2. Write a C program to delete a specific line from the file
3. Write a C Program to find the number of lines in a text file
4. Write a C program to replace a specific line in text file.
5. Write a C Program to capitalize every word in text file
6. Write a C program copy the content of one file to another file
7. Write a C Program to reverse first n characters in a given file
8. Write a C program to convert the content of file to upper case
9. Write a C program to count number characters in a given file
10. Write a C program to merge two file into third file.
11. Write a C Program to find the size of a text file without traversing it character by
character.
12. Write a C Program that merges lines alternately from two files and writes the results
to new file.
13. Write a C Program to list files in a directory
14. Write a C Program to Join Lines of Two given Files and Store them in a New file 
15. Write a C Program to print the content of the given file from specified position.

You might also like