Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace incrementVariable
- {
- class Program
- {
- static void Main(string[] args)
- {
- int incrementTimes = int.Parse(Console.ReadLine());
- int overFlowTimes = incrementTimes / 255;
- byte number = 0;
- for (int i = 0; i < incrementTimes; i++)
- {
- number++;
- }
- if (incrementTimes <= 255)
- {
- Console.WriteLine(number);
- }
- else
- {
- Console.WriteLine(number);
- Console.WriteLine("Overflowed " + overFlowTimes + " times");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement