You are on page 1of 1

Computer Programming

FE-CIS

Practice Problems Set 3

1. 1. Write a program that takes an integer as input from the user, passes it to the
function is_prime (), which checks whether the number is prime or not and
returns 1 if number is prime and 0 otherwise.
main () prints whether the number is prime or not. Moreover, program should be
able to take input as long as user enters y to continue. [Hint: Use do-while
loop ]
2. Develop a program that take two numbers base & exponent ( should be a
positive integer only) as input and passes these values to a function power() ,
which calculates base exponent by multiplying base, exponent times. Make sure,
result is to be returned to main () , which displays it. You are bound to take help
of while loop only.
3. float LbsToKgs( float lb)
4. float KgsToLbs(float kg)
5. void RepeatChar( char ch, int n) // displays character ch , n times on
screen
6. float Displacement( int x1, int y1, int x2, int y2)
calculates displacement between two points P1 (x1, y1) & P2 (x2, y2)
7. float DegreeToFahren( float degree);
8. float FahrenToDegree(float fahren);
9. Implement a function that takes a number as argument and print its binary
equivalent.
10.
Develop the Fibonacci series using recursive functions.
11.
Using recursive function print numbers counting down
12.
Using recursive function print numbers counting up
13.
Recursive function to determine if an input is prime.
14.
Implement char LowerCase(char ch)
Converts ch to lowercase , if ch is a uppercase alphabet
15.
Implement char UpperCase(char ch)
Converts ch to uppercase , if ch is a lower case alphabet
16.
Write a function (non-recursive) to calculate the factorial of any natural
integer entered through keyboard.
long int fact(int);
______________________

Course Teacher: Ali

You might also like