-
Notifications
You must be signed in to change notification settings - Fork 0
/
09.Play With Int Double And String
39 lines (37 loc) · 1.06 KB
/
09.Play With Int Double And String
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
class PlayWithIntDoubleAndString
{
static void Main()
{
Console.WriteLine("Please choose a type:");
Console.WriteLine("1 --> int");
Console.WriteLine("2 --> double");
Console.WriteLine("3 --> string");
int choice = int.Parse(Console.ReadLine());
if (choice==1)
{
Console.WriteLine("Please enter a int:");
int intNum = int.Parse(Console.ReadLine());
intNum = intNum + 1;
Console.WriteLine(intNum);
}
else if (choice == 2)
{
Console.WriteLine("Please enter a double:");
double doubleNum = double.Parse(Console.ReadLine());
doubleNum=doubleNum+1;
Console.WriteLine(doubleNum);
}
else if (choice==3)
{
Console.WriteLine("Please enter a string:");
string str = Console.ReadLine();
str += "*";
Console.WriteLine(str);
}
else
{
Console.WriteLine("Invalid Input!");
}
}
}