Cse115 Lab Manual 12 Function
Cse115 Lab Manual 12 Function
Try yourself2: Write C program using a function to check if a given number is positive, negative, or zero.
Try yourself 3: Write C program using a function to check if a given number is a perfect number.
4. C program to compute sum of all natural numbers between m and n (using function)
5. C program to compute the integer resulting from rounding a number n (using function)
Exercise:
1. Write a C program using 3 functions to compute diameter, circumference and area of a circle whose
radius is given by the user as the input.
2. Find the sum of the following series using a function: 12 + 22 + 32 + … + N2
Assignment:
1. Find the sum of the following series using user-defined function: 1/1! + 2/2! + 3/3! + …… +1/N!
2. Write a C code using functions that takes two integers: a and b as inputs and returns the value of ab.
3. Compute the sum of the following geometric progression using a function with 2 parameters r and n:
4. Write a C program that reads an integer and returns the reverse of that number using function.
5. Write a C program using function that reads a floating point number n and an integer d and then
prints the rounded value of n up to d decimal places. E.g. for n=5.678 and d = 2; it should print 5.68