Professional Documents
Culture Documents
15CSE180 Computer Programming Laboratory Lab 5 Functions: ST TH
15CSE180 Computer Programming Laboratory Lab 5 Functions: ST TH
Lab 5
04 January 2019
Functions
1. Write a C function oddReven() to find whether a given number is odd or even.
Write a C program that calls the above function and print the oddness/evenness
of all numbers from 1 to 100.
2. Write a C function factorial() to find the factorial of a given number. Write
a C program that calls factorial() to print the factorial of all numbers from 1
to 20. (Note: The factorial of a number grows very fast. So decide the variable
type accordingly!!)
3. Write a C function isPrime() to find whether a given number is prime or not.
Write a C program that calls isPrime() and prints the primality of all the
numbers from to 100.
4. Write C function dec2bin() finds the binary equivalent of a given decimal
number. Write a C program that calls dec2bin() to print the binary equivalent
of all numbers from given interval.
6. Write a C function factors() that find the factors of a given number. Write a
C program that calls factors() to print all the factors of numbers from 1 to
20.
where y is the cuberoot approximation of x