Create a new C# project and create a program that assigns values to the specific variables after checking that whether the input is integer, float, signed or unsigned.
Solution:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace alphabet { class Program { static void Main(string[] args) { string a; Console.WriteLine("Enter the a"); int result1; float result2; a = Console.ReadLine(); if (int.TryParse(a, out result1) == true) { Console.WriteLine("Moved to int"); } else if (float.TryParse(a, out result2) == true) { Console.WriteLine("Moved to float"); } Console.ReadLine(); } } }
Post A Comment:
0 comments: