Professional Documents
Culture Documents
16 MARKS
1.a.Write a c program to find a given string is a palindrome or not.
b..Explain in detail about swapping of 2 numbers using Call by Value and Call by reference.
3.a.Design the function void update(int *a,int *b), which reads two integers as argument, and
sets a with the sum of them, and b with the absolute difference of them.
ANSWER:
#include <stdio.h>
*a = *a+*b;
*b = aa-*b;
int main()
int a, b;
printf("%d\n%d", a, b);
return 0;
ANSWER:
#include <stdio.h>
int main()
int a=5;
int b=8;
int c=3;
int d=9;
int v;
v=max_of_four(a,b,c,d);
return 0;
int t2=(c>d)?c:d;
return (t1>t2)?t1:t2;
6.a.Write a C program using Menu driven to perform Swap operation using the following,
i) Call by Value ii) Call by Reference
6.b.Write a C program to find the factorial of the given number using recursive function.
7.a. Create a program that accepts an integer number and a floating point number and print their
addresses and values using pointers.
7.b. Elaborate any four String Manipulations Functions with examples.
8.aBuild a C Program finds the nth Fibonacci numbers using recursion. The first Fibonacci number is
1 and second Fibonacci is also initialized to 1 and print the series.
ANSWER:
#include<stdio.h>
int f(int x);
int main()
{
int n, i = 0, c;
scanf("%d", &n);
return 0;
}
int f(int x)
{
if (x == 0 || x == 1)
return x;
else
return (f(x-1) + f(x-2));
}
8.b Build a C program to Calculate the sum of digits using the following.
i) Functions without argument and return type
ii) Functions with argument and without return type