Starting from:
$35

$29

Homework #6 Solution

Hand in: A student with number 20180000001 should hand in a file named 20180000001.c




for this homework.







 
Write a code which should perform the following operations. It has to take two numbers from user and find multipliers of numbers with a common() function .




For example; Factors of 24 {2,2,2,3}




Factors of 32 {2,2,2,2,2}

Then calculate the common factors recursively which are {2,2,2} and function has to return 2*2*2.







 
Write a code which should perform the following operations. User should enter the length of list and list elements like the list. You can take the list of numbers in the main function.




For example;




Enter the length of the list: 10 Enter the elements of list:

3




9

23




1

8




22

67




0

16




52




Then you should create a function that takes the numbers and show the new list with increasing order. Function has to divide the list into two lists recursively until it can no more be divided. After that it combines all elements with increasing order. Output of the program should be like:




Sorted array is :0 1 3 8 9 16 22 23 52 67.




 
Write a code which should perform the following operations. User should enter an input number. Then create a function which will calculate the output numbers recursively using following formula.



















For example; Input: 45

Output: 45 136 68 34 17 52 26 13 40 20 10 5 16 8 4 2 1







 
Write a code which should perform the following operations. User should enter a number and the code has to check if the number fits the formula or not . Create a function which is checking the input number recursively. Function should gives results “equal” or “Not Equal”.

 


CSE102-Computer Programming
Homework #6
F(x)= (
,=
+ + +






+




) N=number of digit


,≠




+
+





example: Input=371

Output: Equal




Input=372

Output: Not Equal




 
Write a code which should perform the following operations. User should enter a string without space and code should find the first capital letter in the string. You have to write a function which finds the letter recursively.




Input: computerScienceAndEnginnering




Output:S




General Rules:




 
Obey and don’t broke the function prototypes that are shown on each part, if any, otherwise, you will get zero from the related part.




 
You can use the functions that I wrote.




 
Note that if any part of your program is not working as expected, then you can get zero from the related part, even it’s working in some way.

 
Upload your .c file on to Moodle to deliver your homework.




 
You can ask any question about the homework via Moodle Forum. Corresponding TA: ferdaabbasoglu@gtu.edu.tr

More products