You are on page 1of 3

Following are give the function protoypes.

you've to implement and write the


bodies of given function prototypes. Input all values from user in the Main()
program and pass these values to the below functions as parameters. Call all
these functions in Main() program and test them.
1. int smallest(int num1, int num2, int num3);
// it returns smallest value of three numbers.
2. int maximum(int num1, int num2, int num3, int num4, int num5)
// it returns maximum value of five numbers.
3. int integerNumberLength(int num);
// functions calculates the length of any integer number and returns
the length
4. int nameLength(string name);
// function calculates the length of string variable 'name' and returns
its length
5. double circleArea(double radius);
// function calculates the area of circle and returns it...
6. char upperLetter(char ch);
// function converts a lowercase letter to uppercase and returns an
uppercase. If
// letter is already in uppercase then return
the same letter
7. char lowerLetter(char ch);
// function converts a uppercase letter to lowercase and returns an
lowercase
// letter. If letter is already in lowerercase then
return the same letter
8. string largestName(string name1, string name2);
// function compares name1 & name2 and returns the largest name
9. bool pallindrome(int number);
// function checks wether a number is pallindrome or not. Returns true
if number is // pallindrome otherwise returns false
10.void largestNumberLength(int num1, int num2, int num3, int num4);
// displays on console which number has highest length. use
integerNumberLength() function you've written above in part-3.

Let a , b , c, d and e be five integer numbers. Input these five numbers from
user. Write a C++ program with a function having following prototype.
void rotate(int& a, int& b, int& c, int& d, int& e)

rotate function swaps the values of five input parameters a,b,c,d and e inside
the function. Call the rotate function in main program and disply the
updated values of variables.
swap values such that a = b , b = c, c=d, d=e and e = a.

The formula for the Pentagonal numeric sequence is Pn=n*(3n-1)/2. This


yields the sequence 1, 5, 12, 22, 35, and so on. Define a function having one
input parameter 'N', function displays the pentagonal sequence upto 'N'
numbers on console. i.e
void pentagonal(int n);
use above given formula to calculate the pentagonal sequence.

Write a C++ function multiplicationTable() that will output the


multiplication table as shown below. There are total 9 columns and each
column shows the multiplication table of corresponding column number i.e.
colum-1 shows multiplication table of 1, colum-2 shows table of 2, column-3
shows the table of 3 upto so on...
column-1

1*1=1

column-2

2*1=2

column-3 ................................ column-9

3*1=3

................. 9*1=9

1*2=2

2*2=4

3*2=6

................. 9*2=18

1*3=3

2*3=6

3*3=9

................. 9*3=27

1*9=9

2*9=18

3*9=27

.
9*9=81

void multiplicationTable(); // only using loops


call this function in main program and test it.

Write a function "void print_pyramid(int height)" which takes a single


integer argument "height" and displays a "pyramid" of this height made up of
of "*" characters on the screen. call this function in main program and test it.
if height = 5 then it should output like this:

You might also like