Professional Documents
Culture Documents
1. operators
2. algorithm and flowchart
3. Variables
4. loops
5. control structures
6. functions
7. recursion pointers and structures and unions
8 . strings
9. arrays
operators
1. Write a c program to Develop a calculator to convert temperature from Fahrenheit
to Celcius and vise versa { }
4. Write a c program To enter marks of five subjects and calculate total, average and
percentage. { }
5. Write a c program to Calculate the net salary of the employee given basic,da,hra,pf
and lic { }
6. Write a c program to Retrieve the remainder after the division of two numbers
without using mod operator { }
8. Write a c program to Enter two angles of a triangle and find the third angle. { }
10. Write a c program to Input any number from the user and check whether the nth
bit of the given number is set (1) or not (0)(hint: Use bitwise operators) { }
11. Write a c program to add two numbers without using the addition operator.{ }
12. Write a c program to subtract two numbers without using the subtraction
operator.{ }
13. Write a c program to find the largest among three numbers using conditional
operator{ }
loops
1. Find the factorial of a number { }
1.Declare a variable 'C' of integer type . Assign the value 12 to it, with the help of scanf at
the run time and store the integer value of C variable in floating type variable 'B' . Display
the output of the variable B
Testcase 1:
Input:12
Output:12.000000
Testcase 2:
Input:14
Output:14.000000
2.Declare a variable A and store any number in between 97 to 105 in that variable at the
run time using scanf . You need to get the related character of that ASCII number
Testcase 1:
Input :97
Output:a
Testcase 2:
Input:98
Output:b
Testcase:
Input : 3
Output: 3
5
5.Declare a variable S , take the value at the run time for the variable S.
if S value is greater than 18, print "C is very easy" otherwise print " C is beautiful
subject.
Testcase 1:
Input:10
Output: C is beautiful subject
Testcase 2:
Input: 20
Output: C is very easy
Testcase 1:
Input: 10
Output:We study Daily
Testcase 2:
Input:9
Output:We love India
Testcase 2:
Input : 3
4
Output: 3
4
12
11.C Program to print the factorial of a number( Declare one variable N in the program,
calculate the factorial and display the factorial of that number)
Testcase 1:
Input : 5
Output: 120
Testcase 2:
Input: 6
Output : 720
12.C Program to print even numbers from 10 to N( N is the variable , which specifies the
limit)
Testcase 1:
Input: 16
Output : 10
12
14
16
20
13.Declare a variable N , assign the value at the run time using scanf. Check whether the
value of that variable is divisible by 2 and 4
Testcase 1:
Input :8
Output : Yes, it is divisible by both 2 and 4
Testcase 2:
Input : 5
Output: No
14.Declare two integer variables x and y . Assign the values at the run time . Take one
temporary variable " temp" . By using that temp variable, swap the values of both a and
b.
Testcase 1:
Input : 3
5
Output:5
3
Testcase 2:
Input: 4
6
Output: 6
4
15.Declare two variables A and b of integer data type and assign the values to it at the
runtime. Swap the values of A to b and b to A without using temporary Variable
Testcase 1:
Input : 3
5
Output:5
3
Testcase 2:
Input: 4
6
16.Declare two variables a and b of integer datatype, Accept those values from the user
at the run time. store addition of two variable values in another variable c . if the value of
c is greater than or equal to 18 .print" eligible for voting" otherwise "Not eligible"
Testcase 1:
Input: 10
9
Output: eligible for voting
Testcase 2:
Input :3
4
Output: Not eligible
17.Declare a variable A of integer type and store the value in it by using scanf.find the
factorial of that value stored in the variable A , store the value of factorial in another
variable Y and display the value of Y
Testcase 1:
Input: 5
Output:Y=120
Testcase 2:
Input:6
Output:Y=720
19.Declare a variable 'a' of integer value , assign the value using scanf.
1. check whether the value of variable is divisible by 5 and 8 , if yes print "divisible by
both 5 and 8"
2. if the variable value is divisible by 5 only , then print "divisible by 5"
3.if the variable value is divisible by 8 only , then print "divisible by 8"
4. If it is not divisible by both 5 and 8 , then print "divisible by none"
Testcase 1:
Input : 40
Output: Divisible by both 5 and 8
Testcase 2:
Input:8
Output: Divisible by 8
Testcase 1:
Input: a
Output:Vowel
Testcase 2:
Input: b
Output:consonant
22.Declare 4 variables a,b,c,d of integer datatype. Accept the values of c and d at the
runtime .calculate a=c+d and b=c-d.
if a is greater than 18 ,print GITAM or else print INDIA and print the value of b
Testcase 1:
Input: 10
9
Output: GITAM
1
Testcase 2:
Input: 11
12
Output: GITAM
-1
23.Declare one variable A and perform pre increment of that variable and store it in
another variable b. check whether b is a palindrome number or not
Testcase 1:
Input:120
Output: Palindrome Number
Testcase 2:
Input :238
Output: Not a Palindrome number
24.Declare three variables a,,b,c . take the values of b and c at the run time . calculate
a=b+c . Consider the first angle of the triangle as a and second angle of the traingle as c
and calculate the third angle
Testcase 1:
Input: 10
20
Output :140
Testcase 2:
Input :20
50
Output: 90
control structures
1. Check whether the triangle is an equilateral, isosceles, or scalene triangle? { }
13. Write a C program to check whether the given value can form a triangle for the
angles. { }
14. Write a c program to calculate a student's grade by reading six subject marks? { }
15. Write a C program to accept a person's height in centimeters and categorize them
according to their height (dwarf, average height, tall, abnormal height). { }
Functions
3. Write a c program to find out the sum digits of a number using recursion. { }
10.Create a structure with the name GITAM and define the data members of the structure
as a,b,c.The datatype of a is integer , nature of b is float and the datatype of c is String.
Declare one object/variable ‘E’ to the Structure GITAM .Take the values of the data
members using the object/variable ‘E’ at the run time and display those values of the data
members to the output screen
11.Create a structure with the name GITAM and define the data members of the structure
as a,b,c.The datatype of a is integer , nature of b is float and the datatype of c is String.
12.Declare two different objects/variables ‘A’ and ‘B’ to the structure GITAM . Using the
second object/variable,take the values of the data members at the runtime and display
those values of the data members using second object
13.Create a structure with the name GITAM and define the data members of the structure
as a,b,c.The datatype of a is integer , nature of b is float and the datatype of c is String.
Declare one object ‘E’ to the Structure GITAM .Take the values of the data members using
the object ‘E’ at the run time. Call the function ’display’ in the main function and the
functionality of display function is to display the values of the data members of the
structure by using E . In the display function, pass the arguments as data members.
14.Create a structure with the name CSE and define the data members of the structure as
a,b,c.The datatype of a is integer , nature of b is float and the datatype of c is String.
Declare one object ‘E’ to the Structure CSE .Take the values of the data members using
the object ‘E’ at the run time. Call the function ’display’ in the main function and the
functionality of display function is to display the values of the data members of the
structure by using E . In the display function, pass the argument as the complete
structure .
15.Create a structure with the tag name CSE and define the data members of the
structure as a,b,c.The datatype of a is integer , nature of b is float and the datatype of c is
String.
Declare one object ‘E’ to the Structure CSE .Take the values of the data members using
the object ‘E’ at the run time. Call the function ’display’ in the main function and the
functionality of display function is to display the values of the data members of the
structure by using E . In the display function, pass the argument as the address of the
structure .
16.Create a structure with the tagname ECE and define the data members of the structure
as a,b,c.The datatype of a is integer , nature of b is float and the datatype of c is String.
Declare two objects/variables A and B to Structure ECE.Assign the values of the data
members with related to A Object is 1,2.5,”Morraco” at the compile time itself. Pass/Copy
the values of Object A data members to the Object B data members .And display the
values of those data members belonging to Object/Variable B
17.Create a Structure with tag name GITAM and data members are int a , float b and along
with this ,declare one more Structure as a datamember called as CSE . The data
members of the CSE are int c; Assign the values to those data members(using
Objects/variables) using scanf and print those values to the output values. Create G as
an variable/object to the structure GITAM and create C as an variable/object to the
Structure CSE
19.Create a union with the name GITAM and define the data members of the union as
a,b,c.The datatype of a is integer , nature of b is float and the datatype of c is
String.Declare one object/variable ‘E’ to the union GITAM .Take the values of the data
members using the object/variable ‘E’ at the run time and display those values of the data
members to the output screen
20.Create a structure with the name GITAM and define the data members of the structure
as a,b,c.The datatype of a is integer , nature of b is float and the datatype of c is
String.Declare one object/variable ‘E’ to the Structure GITAM . Assign the values as {1} to
the structure by using variable E. Try to print the values of the data members using E
object/variable
Strings
1. Write a c program to convert the string from upper case to lower case. { }
2. Write a c program to convert the string from lower case to upper case. { }
12. Reverse the given string without using String handling functions. { }
Arrays
1. Write a c program for the addition of two matrices. { }
4. Write a c program to find out the sum of the diagonal elements of a matrix. { }
9. Given a two-dimensional array of integers and a row index, return the largest element
in that row. { }
17.Declare a one dimensional Array A ,which stores 5 integer values .Take the values in
to the array at the run time using scanf() , and display those values stored in that array
by using printf()
18.Write a C Program which accepts your name as an input(take the input by using gets)
in character Array called ECE of size 15 and needs to display your name(display the
output using puts)
19.In C Program, declare a character Array ‘Emp’ of size 10. Accept the input into the
character Array using puts and implement the strlen() on the Character Array ‘Emp’
And store the result of that function in a variable called B .and display the value of B
variable to the output screen.
20.Declare a two dimensional array ‘MID3’ .The size of this array is 2 rows and 2 columns
Need to store all the 4 element values as ‘2’ . Display the values of the Array ‘MID3’ in
Matrix format.
21.In C Program, create two character Arrays of size 10 each with the names ABC and
XYZ.Take the input for the ‘ABC’ character array by using puts and implement strrev() on
‘ABC’ character Array and the output of that function needs to be in ‘XYZ’ Character
Array. Print the value of ‘XYZ’ Character Array using gets().
22.Declare two (2-D arrays) A and B of size 2*2 . Need to store elements 2,2,2,2 in Array A
and in B Array ,store the elements as 3,3,3,3. Perform the Addition of the two Arrays A
and B.Print the result of the Addition in matrix format
23.Declare a one dimensional array CSE of size 6 and pass the elements as
23,54,65,90,45,76 at the runtime. Write the code such that the elements has to be printed
in Ascending order of the Array
24.Create a character Array of size 10 and the name of the character Array is CSE.Need to
store your name in CSE Array . Write the code ,such that it has to find how many vowels
and how many characters are there in your name
25.Declare two dimensional array CSE of size 3*3. Assign the values at the compile time
to the array as {{1,2,3},{4,5,6},{6,7,8}}; The output should be the transpose of the array
,write the code for that
26.Create a two dimensional Array with the your name with size 3*4. Assign the values
to the array by using scanf(). The values you need to assign {{1,2,3,4},{4,2,6,7},{8,7,5,6} at
the run time. Print the values of the Array to the output screen
27. Declare a one dimensional array CSE of size 6 and pass the elements as
23,54,65,21,45,76 at the runtime. Write the code such that the elements has to be printed
in Descending order of the Array
28.Create a character Array of size 10 and the name of the character Array is CSE.Need to
store your name and print the value in the character array in reserve direction without
using strrev() function
29.Create a character Array of size 10 and the name of the character Array is CSE.Need to
store your name . If your name contains Vowels, it needs to print “WELCOME TO INDIA”
else it needs to print “WELCOME TO ENGLAND”.
30.Declare two (2-D arrays) A and B . Need to store elements 2,2,2,2 in Array A and in B
Array ,store the elements as 3,3,3,3. Perform the Multiplication of the two Arrays A and
B. Print the result of the Multiplication in matrix format
31.Declare a one dimensional array CSE of size 6 and pass the elements as
23,54,65,21,45,76 at the runtime. Implement the linear search on this array and the data
item needs to be searched is 21
32.Declare a one dimensional array CSE of size 6 and pass the elements as
23,54,87,21,45,76 at the runtime. Write the code which retrieves the largest element in the
array ‘CSE’