0% found this document useful (0 votes)
54 views

Assignment V

Write recursive functions to: 1) Print the binary representation of an integer. 2) Print an integer vertically with each digit on its own line. 3) Calculate the nth term of a sinh series for a given x value. 4) Calculate the sum of all prime numbers between 1 and 100.

Uploaded by

Seravana Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views

Assignment V

Write recursive functions to: 1) Print the binary representation of an integer. 2) Print an integer vertically with each digit on its own line. 3) Calculate the nth term of a sinh series for a given x value. 4) Calculate the sum of all prime numbers between 1 and 100.

Uploaded by

Seravana Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Assignment V

1. Write a recursive function to print binary code of an integer


(Hint: If the input is 10 its equivalent binary code is 1010, use the modulus and division
operator)
2. Write a recursive function which takes an integer as argument and print the same vertically such
as that one digit of it is printed in one line. For example, if we have given 1976 as input, the
output should be
1
9
7
6
(Hint: use modulus and division operator)
3. Write a recursive function to calculate nth term in sinh series for a given value of x

x-x3/3!+x5/5!-x7/7!+.. n terms
4. Write a recursive function to calculate the sum of prime numbers between 1 to 100.

You might also like