0
Please help me develop a program that my teacher left me
Elaborates a program that calculates the total number of figures of a number and its greater digit For example Enter a number: 235579 Total number of figures: 6 Senior digit: 9
6 odpowiedzi
+ 6
You can find each digit in a number like this:
digit = number % 10
number /= 10
Keep doing this as long as number is > 0
+ 1
Like this? (Python)
(I'm sure there is a much better way)
_____________________
try:
num=int(input("Enter a Number: "))
num1=str(num)
num2=list(num1)
print("Total Number of Figures: ", len(num2))
print("Senior Digit: ", max(num2))
except ValueError:
print("Please Use Only Numbers")
+ 1
well, have you tried doing it yourself? I’ll only help if you’re stuck on solving it..
+ 1
I apologize, Its been too long since I've had a go at c++, hopefully someone else can give you some assistance 👍👍 good luck to you though!
0
Thanks
- 1
Work in c++,
Try to do this
Int number[9];
int n;
cout<<"enter number less than 9 digits:"
cin<<n;
number[n];
And i dont know what else to apologize
Im new, sorry