What is a function in C, and why is it used? 1
What are the three main components of a function in C? CO11
What is the difference between a function declaration and a function definition?CO11
What is meant by "function call" in C? CO11
Explain the difference between pass by value and pass by reference with an example.CO21
Distinguish between local and global variables. CO21
What do you mean by the scope of a variable in C? CO21
Explain the difference between automatic, static, and external variables in C.CO21
What do you mean by Library functions and User defined fuctions? CO11
What do you mean by recursion? CO11
What is a function in C, and why is it used? CO12
What are the three main components of a function in C? CO12
What is the difference between a function declaration and a function definition?CO12
What is meant by "function call" in C? CO12
Explain the difference between pass by value and pass by reference with an example.CO22
Distinguish between local and global variables. CO22
What do you mean by the scope of a variable in C? CO22
Explain the difference between automatic, static, and external variables in C.CO22
What do you mean by Library functions and User defined fuctions? CO12
What do you mean by recursion? CO12
#include <stdio.h>
float check(int);
int main()
{
int i = 45;
float c;
CO12.5
c = check(i);
printf("c = %f\n", c);
return 0;
}
float check (int ch)
{
return (ch >= 45? 3.14 : 6.26);
}
#include <stdio.h>
float areacircle (float);
int main()
{
float area;
float radius = 2.0;
area = areacircle(radius);
printf("area = %f\n", area);
return 0;
}
float areacircle (float r)
{
float a;
a = 3.14 * r * r;
printf("a = %f\n", a);
return (a);
}
CO12.5
#include <stdio.h>
int message();
int main()
{
int c = 0;
printf("c before call = %d\n", c);
c = message();
printf("c after call = %d\n", c);
return 0;
}
int message()
{
printf("Centurion University\n");
}
CO12.5
#include <stdio.h>
int add(int);
int main()
{
CO22.5
int i = 3, k, l;
k = add(++i);
l = add(i++);
printf("i = %d k = %d l = %d", i, k, l);
return 0;
}
int add(int ii)
{
++ii;
return(ii);
}
#include <stdio.h>
int func(int, int);
int main()
{
int i = 135, a = 135, k;
k = func(!++i, !a++);
printf("i = %d a = %d k = %d\n", i, a, k);
return 0;
}
int func( int j, int b)
{
int c;
c = j + b;
return (c);
}
CO22.5
#include <stdio.h>
int func1(int);
int main()
{
int k = 35, z;
k = func1(k = func1(k = func1(k)));
printf("k = %d\n", k);
return 0;
}
int func1( int k)
{
k++;
return (k);
}
CO22.5
#include <stdio.h>
int main()
{
printf(" %d", printf("Centurion University"));
CO32.5
return 0;
}
#include <stdio.h>
int main()
{
int i = 1;
if(!i)
printf("Recursive calls are real pain!\n");
else
{
i = 0;
printf("Recursive calls are challenging\n");
main();
}
return 0;
}
CO32.5
#include <stdio.h>
void junk(int, int*);
int main()
{
int i = -5, j = -2;
junk(i, &j);
printf("i = %d j = %d\n", i, j);
return 0;
}
void junk (int i, int *j)
{
i = i * i;
*j = *j * *j;
}
CO42.5
#include <stdio.h>
int check (int, int);
int main()
{
int *c;
c = check(10, 20);
printf("c = %d\n", c);
return 0;
}
int check (int i, int j)
{
int *p, *q;
p = &i;
CO42.5
q = &j;
return (i >= 45 ? p : q);
}
Write a program to accept any number and compute the factorial of the number using
recursion
CO15
Write a program to print fibonacci sequence for 1st 10 numbers using recursion.CO25
Write a program to swap the value of two variables by passing by value into a function.CO35
Write a program to swap the value of two variables by passing by address into a function.CO35
Write a program to accept any string and calculate the length of the string by passing the
array into a function
CO35
Write a function to count the number of digits in a number using recursion.CO35
Write a function to calculate the power of a number (x^y) using function calls.CO35
Write a menu driven program using function to accept a choice from the user to perform
simple calculation (addition, subtraction, multiplication, and division).
CO35
Write a function to count the number of vowels in a given string. CO35
Write a program to accept any number and check if it is a prime number by passing value
into a function.
CO35
#include <stdio.h>
float check(int);
int main()
{
int i = 45;
float c;
c = check(i);
printf("c = %f\n", c);
return 0;
}
float check (int ch)
{
return (ch >= 45? 3.14 : 6.26);
}
CO15
#include <stdio.h>
float areacircle (float);
CO15
int main()
{
float area;
float radius = 2.0;
area = areacircle(radius);
printf("area = %f\n", area);
return 0;
}
float areacircle (float r)
{
float a;
a = 3.14 * r * r;
printf("a = %f\n", a);
return (a);
}
#include <stdio.h>
int message();
int main()
{
int c = 0;
printf("c before call = %d\n", c);
c = message();
printf("c after call = %d\n", c);
return 0;
}
int message()
{
printf("Centurion University\n");
}
CO15
#include <stdio.h>
int add(int);
int main()
{
int i = 3, k, l;
k = add(++i);
l = add(i++);
printf("i = %d k = %d l = %d", i, k, l);
return 0;
}
int add(int ii)
{
++ii;
return(ii);
}
CO25
#include <stdio.h>
int func(int, int);
int main()
{
int i = 135, a = 135, k;
k = func(!++i, !a++);
printf("i = %d a = %d k = %d\n", i, a, k);
return 0;
}
int func( int j, int b)
{
int c;
c = j + b;
return (c);
}
CO25
#include <stdio.h>
int func1(int);
int main()
{
int k = 35, z;
k = func1(k = func1(k = func1(k)));
printf("k = %d\n", k);
return 0;
}
int func1( int k)
{
k++;
return (k);
}
CO25
#include <stdio.h>
int main()
{
printf(" %d", printf("Centurion University"));
return 0;
}
CO35
#include <stdio.h>
int main()
{
int i = 1;
if(!i)
printf("Recursive calls are real pain!\n");
else
{
i = 0;
CO35
printf("Recursive calls are challenging\n");
main();
}
return 0;
}
#include <stdio.h>
void junk(int, int*);
int main()
{
int i = -5, j = -2;
junk(i, &j);
printf("i = %d j = %d\n", i, j);
return 0;
}
void junk (int i, int *j)
{
i = i * i;
*j = *j * *j;
}
CO45
#include <stdio.h>
int check (int, int);
int main()
{
int *c;
c = check(10, 20);
printf("c = %d\n", c);
return 0;
}
int check (int i, int j)
{
int *p, *q;
p = &i;
q = &j;
return (i >= 45 ? p : q);
}
CO45
Write a program to accept any number and compute the factorial of the number using
recursion
CO112
Write a program to print fibonacci sequence for 1st 10 numbers using recursion.CO212
Write a program to swap the value of two variables by passing by value into a function.CO312
Write a program to swap the value of two variables by passing by address into a function.CO312
Write a program to accept any string and calculate the length of the string by passing the
array into a function
CO312
Write a function to count the number of digits in a number using recursion.CO312
Write a function to calculate the power of a number (x^y) using function calls.CO312
Write a menu driven program using function to accept a choice from the user to perform
simple calculation (addition, subtraction, multiplication, and division).
CO312
Write a function to count the number of vowels in a given string. CO312
Write a program to accept any number and check if it is a prime number by passing value
into a function.
CO312