Question: Program #2: Write a small C program: digits.c that: 5. Read an integer number from the command line using scanf( ) 6. Find the number

Program #2:

Write a small C program: digits.c that:

5. Read an integer number from the command line using scanf( )

6. Find the number of digits in the number.

7. Prints the number of digits to the screen.

8. Finish with a value of 0.

The following demonstrates the execution of the program:

root@bahris:01_Lab# ./digits

Enter an integer: 8765

Number of digits in 8765 is 4

root@bahris:01_Lab# ./digits

Enter an integer: abcd

Please enter an integer

root@bahris:01_Lab# ./digits

Enter an integer: 123456789

Number of digits in 123456789 is 9

# echo $? [Macro utilization]

0 [returns zero]

SAMPLE TEST OUTPUT: digits

Program #3:

Write a small C program: reverse.c that:

9. Read an integer number from the command line using scanf( ).

10. Prints the number with its digits reversed to the screen.

11. Finish with a value of 0.

root@bahris:01_Lab# ./reverse

Enter an integer: 7654

The reversed number is 4567

root@bahris:01_Lab# ./reverse

Enter an integer: abcd

Please enter an integer

root@bahris:01_Lab# ./reverse

Enter an integer: 9870

The reversed number is 0789

# echo $? [Macro utilization]

0 [returns zero]

SAMPLE TEST OUTPUT:

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!