C Lab Sheet
C Lab Sheet
LAB SHEET 1
1. Write a program to display name of your college by using printf() function.
2. Write a program to display name, address and phone by using '\t' in printf()
function.
3. Write a program to display name, address and phone by using '\n' in printf()
function.
LAB SHEET 2
1.
2.
3.
4.
Write a program to read two integers and calculate sum, difference and product.
Write a program to calculate the simple interest.
Write a program to calculate the cube of (a+b).
Write a program to ask the user for the radius of a circle and calculate the area and
circumference.
5. Write a program to convert the temperature value given in Celsius to Fahrenheit.
6. Write a program to enter a character in lower case and convert it upper case and
vice versa.(using toupper() & tolower() functions and without using functions)
LAB SHEET 3
1. Write a program to input two integer numbers and find quotient and remainder.
2. Write a program to find the addition, subtraction, multiplication, division and
modulo of given two integer input using shorthand assignment operator.
3. Write a program to find the reverse of three digit integer number.
4. Write a program to find the greatest number among two given by the user using
ternary operator.
5. Write a program to input two integer numbers a and b, compare them, if a is
greater than b add 2 to a else add 3 to b using ternary operator.
LAB SHEET 4
1. Write a program to find the odd or even number using if else statement.
2. Write a program to find the largest of three integer numbers using nested if
statement.
3. Write a program to prints the day depending upon the number inputted by the user
using else if ladder.
4. Write a program to prints the day depending upon the number inputted by the
user. (using switch case)
5. Write a program to calculate sum, difference, multiple, division of two numbers.
[Design menu and use switch case.]
6. Write a program to print the numbers from 10 & 30 by using goto statement.
7. Write a program to find the vowel and consonant of a given character. [Using IF
statement.]
8. Write a program to find the given character is alphabet or numeric. If alphabet
then check uppercase or lower case, if in lower case then convert it into upper and
vice-versa.
LAB SHEET 5
1. Write a program to find the sum of number from 1 to 50.
2. Write a program to enter any digit integer number, reverse it and check whether it
is palindrome or not. ( Use while() loop)
3. Write a program to enter an integer number and check whether it is Armstrong or
not.
4. Write a program to check whether a user inputted number is perfect or not.
5. Write a program to find sum of even numbers from 2 to 100.
6. Write a program to calculate the value of x to the power y.
7. Write a program to generate FIBONACCI number up to nth position
8. Write a program to print the factorial of number (n) entered from keyboard.
9. Write a program that checks given number is prime or not.
10. Write a program to generate multiplication table from 1 to 10.
LAB SHEET 6
1. Write a program to accept any number 'n' and print the sum of square of all
numbers from 1 to n.
2. Write a program to display the Armstrong number from 100 to 200.
3. Write a program to enter the value of n1 and n2 and find and display the prime
number between n1 and n2.
4. Write a program to generate the following output:
a.
b.
c.
1
22
333
4444
55555
*
**
***
****
*****
d.
12345
1234
123
12
1
e.
11111
2222
333
44
5
1
2 3
4 5 6
7 8 9 10
f.
1
12
123
1234
12345
LAB SHEET 7
1. Write a program to accept any number 'n' & print the cube of all numbers from
1to n which is exactly divisible by 3.
2. Write a program to find the leap year between 1900 and 2000..
3. Write a program to display following output:
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
LAB SHEET 8
1. Write a program to enter values in array called myarray of size 15 and display the
elements of array.
2. Write a program to enter values in array called myarray of size 10 and display the
sum of elements of array.
3. Write a program to find the largest and smallest value in array.
4. Write a program to sort the number in ascending order.
5. Write a program to add the numbers in two arrays and assign in next array.
LAB SHEET 9
1. Write a program to evaluate to following polynomial equation.
p(x)=a0x^o+a1x^1+a2x^2+...........a(n-1)x(n-1)^(n-1)+anx^n
2. Write a program to transpose the matrix.
3. Write a program to add two matrix called matrix_a and matrix_b and put the
result in matrix_c.
Write a program to find the product of two matrices
LAB SHEET 10
1. Write a program to generate FIBONACCI number up to nth position. Using
function.
2. Write a program to ask the user for two numbers and print the sum, difference and
product of two numbers.
a. Function without argument, without return type.
b. Function with argument, without return type.
c. Function with argument, with return type.
d. Function without argument, with return type.
3. Write a program to read two integers a and b and calculate (a+b)^3 using
function.
4. Write a program to calculate the factorial of a given number using function
declaration.
. LAB SHEET 11
1. Write a program to read the string from the user and display its length.(using
strlen() and without using strlen())
2. Write a program to enter a string and copy it to another string .( using strcpy()
and without using strcpy())
3. Write a program to enter two string and compare them to check whether they
are same or not.(using strcmp() and without using strcmp()).
4. Write a program to enter two string and concatenate one string to
another(using strcat() and without using strcat());
5. Write a program to enter a string reverse it and check whether it is palindrome
or not.
6. Write a program to sort the 10 strings in alphabetical order.
7. Write a program to find the longest string among 10 strings.
8. Write a program to display the first and last character of 5 strings.
LAB SHEET 12
1.
2.
3.
4.