0% found this document useful (0 votes)
5 views1 page

Functions Questions

The document contains a series of assignment questions focused on writing functions in C++. It includes tasks such as checking for palindromes, calculating the sum of digits, performing a specific mathematical operation with two numbers, finding the largest of three numbers, and determining the next character in the English alphabet. Each question outlines the requirements and provides examples for clarity.

Uploaded by

cm2810451
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Functions Questions

The document contains a series of assignment questions focused on writing functions in C++. It includes tasks such as checking for palindromes, calculating the sum of digits, performing a specific mathematical operation with two numbers, finding the largest of three numbers, and determining the next character in the English alphabet. Each question outlines the requirements and provides examples for clarity.

Uploaded by

cm2810451
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Functions

(Assignment Questions)

Question 1 : Write a function to check if a number is a palindrome in C++.


(121 is a palindrome, 321 is not)

A number is called a palindrome if the number is equal to the reverse of a number.


Eg : 121 is a palindrome because the reverse of 121 is 121 itself. On the other hand, 321
is not a palindrome because the reverse of 321 is 123, which is not equal to 321.

Question 2 : Write a function to calculate the sum of digits of a number.

Question 3 : Write a function which takes 2 numbers as parameters (a & b) and


outputs : a^2 + b^2 + 2*ab.

Question 4 : Write a function that prints the largest of 3 numbers.

Question 5 : Write a function that accepts a character (ch) as parameters & returns
the character that occurs after ch in the English alphabet.
Eg : input = ‘c’, return value = ‘d’

Note : for ch = ‘z’, return ‘a’.

You might also like