100% found this document useful (1 vote)
39 views

C Lab Questions

Uploaded by

Nathanel Rupondo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
39 views

C Lab Questions

Uploaded by

Nathanel Rupondo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

1. Write a program to calculate simple and compound interest.

2. Write a program to swap values of two variables with and without using third variable.
3. Write a program to display the size of every data type using “sizeof” operator.
4. Write a program to illustrate the use of unary prefix and postfix increment and
decrement operators.
5. Write a program to input two numbers and display the maximum number.
6. Write a program to find the largest of three numbers using ternary operators.
7. Write a program to find the roots of quadratic equation.
8. Write a program to input name, marks of 5 subjects of a student and display the name
of the student, the total marks scored, percentage scored and the class of result

1. Write a Program to Check Whether a Number is Prime or not.


2. Write a program to find the largest and smallest among three entered numbers and also
display whether the identified largest/smallest number is even or odd.
4. Write a program to check whether the entered year is leap year or not (a year is leap if it is
divisible by 4 and divisible by 100 or 400.)
5. Write a program to find the factorial of a number.
6. Write a program to check number is Armstrong or not. (Hint: A number is Armstrong if
the sum of cubes of individual digits of a number is equal to the number itself).

Programs List
1. Write a program to add, subtract, multiply and divide two integers using userdefined type
function with return type.
2. Write a program to calculate sum of first 20 natural numbers using recursive function.
3. Write a program to generate Fibonacci series using recursive function.
4. Write a program to swap two integers using call by value and call by reference methods of
passing arguments to a function.
5. Write a program to find sum of digits of the number using Recursive Function.
6. Write a program to read an integer number and print the reverse of that number using
recursion. 7. Write a C program to find maximum and minimum between two numbers using
functions.
8. Write a C program to check whether a number is even or odd using functions.
9. Write a C program to check whether a number is prime, Armstrong or perfect number
using functions.
10. Write a C program to find power of any number using recursion.

Programs List
1. Write a program to find the sum of all the elements of an array using pointers.
2. Write a program to swap value of two variables using pointer.
3. Write a program to add two numbers using pointers.
4. Write a program to input and print array elements using pointer.
5. Write a program to copy one array to another using pointer.
6. Write a program to swap two arrays using pointers.
7. Write a program to reverse an array using pointers.
8. Write a program to search an element in array using pointers.
9. Write a program to add two 2 X 2 matrix using pointers.
10. Write a program to multiply two 2 X 2 matrix using pointers.
11. Write a program to find length of string using pointers.
12. Write a program to copy one string to another using pointer.
13. Write a program to concatenate two strings using pointers.
14. Write a program to compare two strings using pointers.

1. C Program to list all files and sub-directories in a directory


2. C Program to count number of lines in a file
3. C Program to print contents of file
4. C Program to copy contents of one file to another file
5. C Program to merge contents of two files into a third file
6. C program to delete a file

Programs List
1. Write a program to add, subtract, multiply and divide two integers using userdefined type
function with return type.
2. Write a program to calculate sum of first 20 natural numbers using recursive function.
3. Write a program to generate Fibonacci series using recursive function.
4. Write a program to swap two integers using call by value and call by reference methods of
passing arguments to a function.
5. Write a program to find sum of digits of the number using Recursive Function.
6. Write a program to read an integer number and print the reverse of that number using
recursion. 7. Write a C program to find maximum and minimum between two numbers using
functions.
8. Write a C program to check whether a number is even or odd using functions.
9. Write a C program to check whether a number is prime, Armstrong or perfect number
using functions.
10. Write a C program to find power of any number using recursion

Programs List
1. Write a Program to Search an element in array.
2. Write a Program to perform addition of all elements in Array.
4. Write a Program to reverse the array elements in C Programming.
5. Write a Program for deletion of an element from the specified location from Array.
6. Write a Program to access an element in 2-D Array.
7. Write a program for addition of two matrices of any order in C.
8. Write a Program to multiply two 3 X 3 Matrices.
9. Write a program to read a string and check for palindrome without using string related
function (a string is palindrome if its half is mirror by itself eg: abcdcba).
10. Write a program to accept a string and count the number of vowels present in this string

Programs List
1. Write a program to count number of digits in a given integer.
2. Write a program to reverse a given integer.
3. Write a program to print number in reverse order with a difference of 2.
4. Write a program to print the sum of digits of a number using for loop.
5. Write a program to check whether a number is Palindrome or not.
6. Write a program to generate Fibonacci series.
7. If a four-digit number is input through the keyboard, write a program to obtain the sum of
the first and last digit of this number.
8. Write a program to find GCD (greatest common divisor or HCF) and LCM (least common
multiple) of two numbers.

You might also like