check_byte |
using System; //csc check_byte_1.cs //my example class check_byte { public byte b; } class test { public static void Main() { //create object check_byte cb= new check_byte(); //out put inside a command window Console.WriteLine("Welcome to Hello world"); Console.Write("enter a number: "); //read input from the commandline int str = Int32.Parse(Console.ReadLine()); cb.b =(byte)(str * str); Console.WriteLine("Total Byte used: " + cb.b); bool bonus ; if (cb.b > 100) { bonus= true; Console.WriteLine(cb.b + " Byte is more than 100 ? " + bonus);} else { bonus= false; Console.WriteLine( cb.b + " Byte is more than 100 ? " + bonus);} } } |
run time |