Even Semester 2020-2021
C Programming Lab (Week 11)
1. Write a recursive function to find the sum of digits of a number.
2. Write a recursive function to find the factorial of a given number.
3. A positive integer is entered through the keyboard, write a function to find the binary
equivalent of this number using recursion.
4. Write a program Move all zeroes to end of array.
Input: {1, 9, 8, 4, 0, 0, 2, 7, 0, 6, 0}
Output: {1, 9, 8, 4, 2, 7, 6, 0, 0, 0, 0}.
5. Rotate the array by position k. Input: {1, 2, 3, 4, 5, 6, 7}, k=2 Output: {3, 4, 5, 6, 7, 1, 2}
6. Take a 3*3 matrix as key board input. Write a program to calculate sum of upper triangle
matrix.
7. Write a program to find second highest and second lowest number of an array. Take Input
from keyboard.
8. Given an array of positive integers. All numbers occur even number of times except one
number which occurs odd number of times. Try to solve this question with the use of
single loop only.
9. You are given an array of 0s and 1s in random order. Segregate 0s on left side and 1s on
right side of the array. You are supposed to use only one loop only.
10.You have given a character array which contain a sentence from user side. Write a
program to count number of words, alphabets.
11.Write a c program to find the length of string without using strlen() function.
12.You have given two n*n matrices from user side. Write a program to find sum and
difference matrix.
13.Write a program for a character array modification in following way.
Input- my name is bharat
Output- MY NAME IS BHARAT
14.You must take a sentence as key board input and write a program to reverse each word of
the sentence.