create a function which accept an integer as parameter and return the largest digit create another function to input 10 integers and find the sum of the largest digit of each number
plz do this who will be do this perfect I will mark him as brainliest
Answers
Answered by
1
Answer:
// CPP program to largest and smallest digit of a number
#include <bits/stdc++.h>
using namespace std;
// Function to the largest and smallest digit of a number
void Digits(int n)
{
int largest = 0;
int smallest = 9;
while (n) {
int r = n % 10;
// Find the largest digit
largest = max(r, largest);
// Find the smallest digit
smallest = min(r, smallest);
n = n / 10;
}
cout << largest << " " << smallest;
}
// Driver code
int main()
{
int n = 2346;
// Function call
Digits(n);
return 0;
Similar questions