Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace ConsoleApp1;
- using System.Text;
- public class Task03
- {
- public void Run()
- {
- Console.InputEncoding = Encoding.Unicode;
- Console.OutputEncoding = Encoding.Unicode;
- Console.WriteLine( "Введите имя:" );
- string userName = Console.ReadLine();
- Console.WriteLine( "Введите возраст:" );
- int userAge = int.Parse( Console.ReadLine() );
- Console.WriteLine( "Введите знак зодиака:" );
- string zodiacName = Console.ReadLine();
- int tenDivider = 10;
- int hundredDivider = 100;
- int remainderOfDivisionBy10 = userAge % tenDivider;
- int remainderOfDivisionBy100 = userAge % hundredDivider;
- int tenDividerThresholdLow = 0;
- int tenDividerThresholdHigh = 4;
- int hundredDividerThresholdLow = 11;
- int hundredDividerThresholdHigh = 14;
- bool isYearSuffixEqualsLet = remainderOfDivisionBy10 == tenDividerThresholdLow || remainderOfDivisionBy10 > tenDividerThresholdHigh ||
- (remainderOfDivisionBy100 >= hundredDividerThresholdLow && remainderOfDivisionBy100 <= hundredDividerThresholdHigh);
- string yearSign = isYearSuffixEqualsLet
- ? "лет"
- : remainderOfDivisionBy10 == 1
- ? "год"
- : "годa";
- Console.WriteLine( $"Вас зовут {userName}, вам {userAge} {yearSign}, вы {zodiacName} и работаете на заводе." );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement