Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

An integer n is divisible by 9 if the sum of its digits is divisible by 9. Develop a program to display each digit,starting with

An integer n is divisible by 9 if the sum of its digits is divisible by 9. Develop a program to display each digit,starting with the rightmost digit. Your program should also determine whether or not the number is divisible by 9. Test it on the following numbers n=154368 n=621594 n=123456 Hint: use the % operator to get each digit; then use / to remove that digit. So 154368 % 10 gives 8 and 154368 / 10 gives 15436. The next digit extracted should be 6,then 3 and so on. 2) Redo the program above by reading each digit of the number to be tested into a type char variable digit . Display each digit and form the sum of the numeric values of the digits. Hint: The numeric value of digit is (int) digit - (int) 0 (IN C WITH COMMENTS) PART ONE AND TWO

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual C# And Databases

Authors: Philip Conrod, Lou Tylee

16th Edition

1951077083, 978-1951077082

More Books

Students also viewed these Databases questions

Question

Why should there be any inventory?

Answered: 1 week ago