Question: Dear All, Write a C program which rounds a given real number to a whole integer according to the given rule. The program takes three

 Dear All, Write a C program which rounds a given real

Dear All, Write a C program which rounds a given real number to a whole integer according to the given rule. The program takes three numbers from the user, n1, n2 and n3.n1 represents decimal part, n2 represents floating point part of the number. n3 represents the number of zeros when it is rounded on the decimal part. Do not use type casting. Rounding RULE: A digit is larger than or equal to 5, the previous digit becomes incremented. If a digit is less than 5, the previous digit remains the same. e.g. 3456 278 2 (so the number is 3456.278 and n1=3456, n2=278, n3=2) Output is 3500 Input: 1442 365 2 Output: 1400 Input: 1444 447 2 Output: 1500

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!