You are on page 1of 2

Subject: PRF192- PFC

Workshop 03
Objectives:
(1) Practicing skills at analyzing and implementing programs using user-defined functions.
(2) Making familiar with some basic algorithms

Ex1 ( 2 marks) : Write a C program to input radius of circle from user and find diameter,
circumference and area of the given circle using function

Example

Input

Input radius: 10

Output

Diameter = 20
Circumference = 62.83
Area = 314.16

Ex2 ( 2 marks) : Write a function in C programming to find prime numbers using function. How
to find all prime numbers between two intervals using functions.

Example

Input

Input lower limit: 10


Input upper limit: 50

Output

Prime numbers between 10-50 are: 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47
Ex3 ( 2 marks) : Write a function to swap 2 user-entered integers

Example

Input

Input a = 10
Input b= 50

Output

output a = 50
output b= 10

Ex4 ( 2 marks) : Print out the minimum and the maximum digits of a nonnegative integer
integer.

Example

Input

n= 10293

Output

Max Number : 9

Min Number : 0

Ex5 ( 2 marks) : Write a C program to print the first n prime numbers.

Example

Input

n= 7

Output

2 3 5 7 11 13 17

You might also like