AD1

Tuesday, 15 November 2016

Write a recursive function that finds the binary equivalent of an integer 

solution 


write a recursive function to calculate the sum of the first 25 natural numbers

solution 

Write a recursive function to print the first 25 elements of fibonacci series 

fibonacci series is characterized by the fact that every number after the first two is the sum of the two preceding ones
0,\;1,\;1,\;2,\;3,\;5,\;8,\;13,\;21,\;34,\;55,\;89,\;144,\;\ldots \;

solution


Monday, 14 November 2016

Write a recursive function to calculate the sum of digits of an integer 

write a recursive function that accepts an integer and finds sum of its digits , as example sum(2370) will print 12

solution


Saturday, 12 November 2016

sum,average and standard deviation



Write a function that receives 5 integers and returns the sum, average and standard deviation of these numbers. Call this function from main( ) and print the results in main( ).  

solution 

Prime factors

A positive integer is entered through the keyboard. Write a function to obtain the prime factors of this number.For example, prime factors of 24 are 2, 2, 2 and 3, whereas prime factors of 35 are 5 and 7.

solution