Computer Programming in C-Assignment November 2024
Computer Programming in C-Assignment November 2024
3.a) Distinguish between formal arguments and actual arguments in function calling.
b) Write a recursive function to get GCD of two numbers.
4.a) Write a C program to display list of all leap years between 1800 and 2200.
b) Explain conditional operator with suitable example.
5.a) Write a program to enter a number and then calculate the sum of its digits.
b) What will be the output of the following code?
main()
{
int x = 3, y, z;
y=x=10;
z=x<10;
printf(“\n x = %d, y = %d, z = %d”,x,y,z);
}
6.a) What happens when an array is initialized with fewer initializers as compared to its size?
b) Write a program to count the total number of non-zero elements in a two-dimensional array.
1
7.a) How are arrays related to pointers? Explain with example.
b) Write a program in C to find the length of a string without using library functions.
8.a) Write a program to swap two integers using call by reference of passing arguments to a function.
b) What will be the output of the following program?
main()
{
int arr[] = {1,2,3,4,5};
int *ptr, i;
ptr = arr + 4;
for(i = 0; i < 5; i++)
printf(“ %d”, *(ptr - i));
}