[SOLVED] CSE114-Assignment 2

35.00 $

Category:

Description

5/5 - (1 vote)

In this assignment you are going to implement a function that takes a number with at least two digits and splits its digits into two parts.

•       If number has odd number of digits omit the middle number. E.G.

23697

23 97

12

1 2

1597

15 97

2345897

234 897

•       Assign the minimum value to a variable a, and maximum to b.

•       Implement a for loop that iterates 10 times.

•       For loop will perform the formulas below, a = 3a +2 b = 2b +3

•       After every single iteration check the values of a and b, whenever a becomes larger than b, swap their values.

•       Function will return 1 as soon as a and b become equal.

•       Otherwise, it will return 2.

•       Do not use <math.h>.

⚫ In the main function:

Ask user to enter a number.

Continue getting values from the user, using a while loop, stop the loop if the function you have implemented returns 1.   Print out the output similar to the example outputs.