Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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 28370Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started