#include<stdio.h> #include<conio.h> int main() { int a=0; int b[10]; int i=0, j=0; int flag=0;
printf("please in put a number:"); scanf("%d",&a);
while (a%10>0) { b[i++]=a%10; a=a/10; }
for (j=0; j<=i; j++) { if (b[j]>flag) flag=b[j]; } printf("%d",flag); }
等时光的邂逅
2024-11-07 03:48:28
int find_max_digit(int num) { int max_digit = 0; while (num) { int tmp_digit = num % 10; if (tmp_digit > max_digit) { max_digit = tmp_digit; } num /= 10 } return max_digit; }
仙蒂瑞拉
2024-11-07 03:08:48
使用char buffer[]
梨花雨凉
2024-11-07 02:25:16
unsigned int fun(unsigned int iValue) { unsigned int inputvalue = iValue; unsigned int a = 0; while(inputvalue) { unsigned int b = inputvalue % 10; if(b >= a) { a = b; } inputvalue = inputvalue / 10; } return a; }