Question

In C Programing10. Write a series of statements that reads in a 3 digit integer and assigns it to identifier x then outputs the maximum digi

0 0
Add a comment Improve this question Transcribed image text
Answer #1

// Screenshot of the code

- 2 x * TDM-CCC 4.9.2 64-bit Release CAUsers alsrini Desktop\maxdigit.c - Dev-C++ 5.11 File Edit Search View Project Execute

// Sample output

C:\Users\alsriniv\Desktop\maxdigit.exe Enter number :549 maximum digit of the number is 9 Process exited after 2.29 seconds w

// Code to copy

#include <stdio.h>
int main()
{
int num, large = 0, rem = 0;

/* get the input from the user */
printf("Enter number :");
scanf("%d", &num);

/* finding the largest digit of the given input */
while (num > 0) {
rem = num % 10;

if (rem > large) {
large = rem;
}

num = num / 10;
}

/* print the largest digit of the number */
printf("maximum digit of the number is %d\n", large);
return 0;
}


Add a comment
Know the answer?
Add Answer to:
In C Programing 10. Write a series of statements that reads in a 3 digit integer...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • ***USING PYTHON***Write a program that reads a five-digit positive integer and breaks it into a sequence...

    ***USING PYTHON***Write a program that reads a five-digit positive integer and breaks it into a sequence of individual digits. for example , thin put 16384 is displayed as: 1 6 3 8 4

  • in python only 15. Write a program that reads a five-digit positive integer and breaks it...

    in python only 15. Write a program that reads a five-digit positive integer and breaks it into a sequence of individual digits. For example, the input 16384 is displayed as 16384

  • C++ PROGRAMING Write a program that reads numbers from the input stream until a zero is...

    C++ PROGRAMING Write a program that reads numbers from the input stream until a zero is encountered. Display the average (rounded down to an integer), the maximum number and the minimum number. Assume that numbers entered will be between 1 and 1000. For example: Enter a number: 33 Enter a number: 88 Enter a number: 77 Enter a number: 22 Enter a number: 66 Enter a number: 55 Enter a number: 0 Average: 56 Max: 88 Min: 22 Another example:...

  • how to solve this on c++? Write a program that reads a five digits integer, then...

    how to solve this on c++? Write a program that reads a five digits integer, then swaps the unit position digit with the ten thousandth position digit, also swap the tenth position digit with the thousandth position digit. Print the new number For example if the number is 37846 then the new number is 64873. Sample input / output: nter a five digits integer The new form of the number 37846 is 64873

  • Spring 2019/2020 Lab 04: Boolean type and if-statements 1. Write a program that reads four integer...

    Spring 2019/2020 Lab 04: Boolean type and if-statements 1. Write a program that reads four integer numbers, then outputs the maximum number of the four and their average. 2. Write a program to enter a number then state if the number has the following descriptions: • If it is even or odd • if it is a multiple of 8 or not 3. Write a program that enters a temperature and prints an appropriate message according to the following: Temperature...

  • Write a program that first reads an integer for the array size, then reads numbers into...

    Write a program that first reads an integer for the array size, then reads numbers into the array, computes their average, and finds out how many numbers are above the average. Make sure to include pointer syntax. Example output: Enter array size: 10 10 random numbers between 1 and 10 generated are: 2 8 5 1 10 5 9 9 3 5 The average is: 5.7 Number of items above the average = 4 C++ Code only.

  • 1. DOES A DIGIT APPEAR IN AN INTEGER, Write a recursive function appears(n,i) that returns true...

    1. DOES A DIGIT APPEAR IN AN INTEGER, Write a recursive function appears(n,i) that returns true if the digit i appears in the positive (base 10) integer n, false if it does not in c++. ex. Enter a positive integer: 54321 Enter a digit: 7 The digit 7 does NOT appear in the integer 54321. 2. IS AN INPUT STRING A PALINDROME? A palindrome is a string in which the letters are the same in both directions, disregarding capitalization and...

  • Write a program that reads in an integer, and breaks it into a sequence of individual...

    Write a program that reads in an integer, and breaks it into a sequence of individual digits. Display each digit on a separate line. For example, the input 16384 is displayed as 1 6 3 8 4 You may assume that the input has no more than five digits and is not negative. - need Algorithms, Java Program and screenshot, please.

  • write a C++ program that reads in a text file and reads each character or lexemes...

    write a C++ program that reads in a text file and reads each character or lexemes and states what token it is and writes to another file for example: while (fahr < upper) a = 23.00 whileend Output: token lexeme -------------------------------- keyword while separator ( identifier fahr operator < identifier upper separator ) identifier a operator = real 23.00 keyword whileend the program aslo reads in comments but does not add to the list. characters that are commented out or...

  • Write an application in java that reads in a five-digit integer and determines whether it is...

    Write an application in java that reads in a five-digit integer and determines whether it is a palindrome. If the number is not five digits long, display an error message and allow the user to enter a new value. Tips: 1. Determine the number of digits in the value input by the user , i.e. prompt the user to enter the number of digits of the number. Use a while loop to determine whether the user input contains the proper...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT