Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //1
- //public static int HighDog (int x,char h)
- //{
- // int y = 0, total;
- // if (h == 's')
- // y = 4;
- // if (h == 'm')
- // y = 8;
- // if (h == 'b')
- // y = 12;
- // total = y * x;
- // return total;
- //}
- public static int SumDigits(int num)
- {
- int sum = 0;
- while (num > 0)
- sum += num % 10;
- num /= num;
- return sum;
- }
- static void Main(string[] args)
- {
- //1
- //int x = int.Parse(Console.ReadLine());
- //char high = char.Parse(Console.ReadLine());
- //while (high!=' ')
- //{
- // Console.WriteLine("total :"+HighDog(x, high));
- // x = int.Parse(Console.ReadLine());
- // high = char.Parse(Console.ReadLine());
- //}
- int x=0,y=0;
- int num = int.Parse(Console.ReadLine());
- x = SumDigits(num);
- if (x > 9)
- {
- while (!(x < 10))
- {
- y= SumDigits(x);
- }
- if (y == 9)
- Console.WriteLine("good in 9");
- else Console.WriteLine("not good");
- }
- else
- if (x == 9)
- Console.WriteLine("good in 9");
- else Console.WriteLine("not good");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement