CSE114 ASSIGNMENT 2 Solved

35.00 $

Category: Tags: , ,

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. (60 pts)

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.  •  •  For loop will perform the formulas below,

Implement a for loop that iterates 10 times.

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(40 pts):

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.

Warning:

⚫  Submit only the source file in the format assignment2_name_surname.c  ⚫  Be sure the extension of your file is c. If you do not know how to check the extension

please look at the file (“How to run your code?”) on the coadsys.

⚫  Do not use any library other than stdio.

Example Output 1

Example Output 2

 

  • Assignment2-m28den.zip