Question: USING C LANGUAGE USE stdio.h only DO NOT USE GLOBAL VARIABLES DO NOT USE ARRAYS, STRUCTS OR UNIONS USE LOOP STATEMENTS USE int and float

USING C LANGUAGE

USE stdio.h only DO NOT USE GLOBAL VARIABLES DO NOT USE ARRAYS, STRUCTS OR UNIONS USE LOOP STATEMENTS USE int and float only CREATE A FUNCTION

USING C LANGUAGE USE stdio.h only DO NOT USE GLOBAL VARIABLES DO

NOT USE ARRAYS, STRUCTS OR UNIONS USE LOOP STATEMENTS USE int and

To drop all digits after a given position, 1. Find the digit at the given position (keep digit), and look at the digit to the right of it. 2. Change all digits to the right of the keep digit to 0. The user will provide a positive integer, and the position of the keep digit. The rightmost digit is position 1, the digit before it is position 2, and so on. Study the examples below. Example 1: Example 2: Assume that the number is 8279502, and the digit position provided by the user is 3. Assume that the number is 28379, and the digit position provided by the user is 2. Position: 5 4 3 2 1 Position: 7654321 Number: 8 279502 Number: 28379 Thus, the keep digit is 5. Thus, the keep digit is 7. Position: 3 Position: 2 Number: 8279502 Number: 28379 All digits to the right of 5 are changed || All digits to the right of 7 are to 0. changed to 0. Position: 3 Position: 2 Number: 8 279 500 Number: 28370 Thus, dropping all digits at the right of Thus, dropping all digits at the right position 3 of the number 8279502 will of position 2 of the number 28379 result to 8279500. will result to 28370

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!