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

29th May 2019, 9:12 PM
Vash
Vash - avatar
6 Respostas
+ 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
30th May 2019, 4:54 AM
Anna
Anna - avatar
+ 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")
29th May 2019, 9:28 PM
BelowZer0
BelowZer0 - avatar
+ 1
well, have you tried doing it yourself? I’ll only help if you’re stuck on solving it..
29th May 2019, 9:30 PM
Choe
Choe - avatar
+ 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!
30th May 2019, 2:24 AM
BelowZer0
BelowZer0 - avatar
0
Thanks
30th May 2019, 11:31 AM
Vash
Vash - avatar
- 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
29th May 2019, 9:39 PM
Vash
Vash - avatar