You are on page 1of 1

19CSE102 COMPUTER PROGRAMMING

EVALUATION LAB – 2
SET 1
1. Write a C function isprime(num) that accepts an integer argument and returns 1 if the
argument is a prime or 0 otherwise. Write a program that invokes this function to generate
prime numbers between the given ranges. [CO 4, BTL 3] [ 10 marks]

2. Write a C recursive function for multiplying two integers where a function call is passed
with two integers m and n. [CO 4, BTL 3] [ 10 marks]

SET 2

1. Write a program to find GCD and LCM of two numbers using concept of functions.
[CO 4, BTL 3] [ 10 marks]

Output
GCD of 12 and 8 = 4
LCM of 12 and 8 = 24

2. Given a binary number as input, we need to write a program to convert the given
binary number into an equivalent decimal number using recursive functions. [CO 4,
BTL 3] [ 10 marks]
Examples :
Input : 111
Output : 7

Input : 1010
Output : 10

Input: 100001
Output: 33

You might also like