VD: 18534 max=8
- Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class bai7
{
public static void Main()
{
int n, s, t;
Console.Write("Nhap vao mot so: ");
n = Convert.ToInt32(Console.ReadLine());
s = t = 0;
while (n != 0)
{
s = n % 10;
if (s > t) t = s;
n = n / 10;
}
Console.Write("\nKy so lon nhat trong n: " + t);
Console.Read();
}
}