1. Write a C program to print your name.
2. Write a C program to add two numbers.
3. Write a C program to add two numbers using pass by value
Function declarations
int input();
int add(int a, int b);
void output(int a, int b, int sum);
Input
1
2
Output
The sum of 1 and 2 is 3
4. Write a C program to add two numbers using pass by reference
Function Declarations
int input();
void add(int a, int b, int *sum);
void output(int a, int b, int sum);
Input
1
2
Output
The sum of 1 and 2 is 3
5. Write a C program to compare three numbers using pass by value
Function Declarations
int input();
int compare(int a, int b, int c);
void output(int a, int b, int c, int largest);
Input
1
2
3
Output
The largest of 1,2 and 3 is 3.
6. Write a C program to compare three numbers using pass by reference
Function Declarations
int input();
void compare(int a, int b, int c, int *largest);
void output(int a, int b, int c, int largest);
Input
1
1
0
Output
7. Write a C program to find sum of all natural numbers until n
Function Declarations
int input_n();
int sum_n_nos(int n);
void output(int n, int sum);
Input
1
2
3
Output
The largest of 1,2 and 3 is 3.
8. Write a C program to find the sum of n different numbers entered by the user.
Function Declarations
int input_array_size();
void input_array(int n, int a[n]);
int sum_n_array(int n, int a[n]);
void output(int n, int a[n],int sum);
Input
Input array size: 3
Input the array:
1 7 11
Output
1+7+11 is 19