You are on page 1of 20

class Program

{
static void Main(string[] args)
{
int dValue;
Console.Write("Enter integer number that represents day of the week:
");
dValue = Convert.ToInt32(Console.ReadLine());
if ((dValue >= 1) && (dValue <= 7)) {
if (dValue == 1)
Console.Write("Day in word: Monday");
if (dValue == 2)
Console.Write("Day in word: Tuesday");
if (dValue == 3)
Console.Write("Day in word: Wednesday");
if (dValue == 4)
Console.Write("Day in word: Thursday");
if (dValue == 5)
Console.Write("Day in word: Friday");
if (dValue == 6)
Console.Write("Day in word: Saturday");
if (dValue == 7)
Console.Write("Day in word: Sunday");
}
if ((dValue < 1) || (dValue > 7)) {
Console.Write("Error Message: Invalid day value!");
}
Console.ReadKey();
}
}
==================================================
==================================================
==================================================
==================================================
class Program
{
static void Main(string[] args)
{
int dValue;
Console.Write("Enter integer number that represents day of the week:
");
dValue = Convert.ToInt32(Console.ReadLine());
if (dValue == 1)
Console.Write("Day
else if (dValue == 2)
Console.Write("Day
else if (dValue == 3)
Console.Write("Day
else if (dValue == 4)
Console.Write("Day
else if (dValue == 5)
Console.Write("Day

in word: Monday");
in word: Tuesday");
in word: Wednesday");
in word: Thursday");
in word: Friday");

else if (dValue == 6)
Console.Write("Day in word: Saturday");
else if (dValue == 7)
Console.Write("Day in word: Sunday");
else
Console.Write("Error Message: Invalid day value!");
Console.ReadKey();
}
}

==================================================
==================================================
==================================================
==================================================
class Program
{
static void Main(string[] args)
{
int iValue;
Console.Write("Enter integer number: ");
iValue = Convert.ToInt32(Console.ReadLine());
if (iValue >= 0)
Console.Write("Result: {0} is a positive value!", iValue);
else
Console.Write("Result: {0} is a negative value!", iValue);
Console.ReadKey();
}
}

==================================================
==================================================
==================================================
==================================================
class Program
{
static void Main(string[] args)
{
int grade;
Console.Write("Enter gradevalue: ");
grade = Convert.ToInt32(Console.ReadLine());
if ((grade >= 50) && (grade <= 100))
{

if ((grade >= 50) && (grade <= 74)) {


Console.WriteLine("Decimal equivalent:
Console.WriteLine("Remarks: FAILURE");
}
if (grade == 75) {
Console.WriteLine("Decimal equivalent:
Console.WriteLine("Remarks: PASSED");
}
if ((grade >= 76) && (grade <= 78)) {
Console.WriteLine("Decimal equivalent:
Console.WriteLine("Remarks: PASSED");
}
if ((grade >= 79) && (grade <= 81))
{
Console.WriteLine("Decimal equivalent:
Console.WriteLine("Remarks: PASSED");
}
if ((grade >= 82) && (grade <= 84))
{
Console.WriteLine("Decimal equivalent:
Console.WriteLine("Remarks: PASSED");
}
if ((grade >= 85) && (grade <= 87))
{
Console.WriteLine("Decimal equivalent:
Console.WriteLine("Remarks: PASSED");
}
if ((grade >= 88) && (grade <= 91))
{
Console.WriteLine("Decimal equivalent:
Console.WriteLine("Remarks: PASSED");
}
if ((grade >= 92) && (grade <= 94))
{
Console.WriteLine("Decimal equivalent:
Console.WriteLine("Remarks: PASSED");
}
if ((grade >= 95) && (grade <= 97))
{
Console.WriteLine("Decimal equivalent:
Console.WriteLine("Remarks: PASSED");
}
if ((grade >= 98) && (grade <= 100))
{
Console.WriteLine("Decimal equivalent:
Console.WriteLine("Remarks: PASSED");
}

5.00");

3.00");

2.75");

2.50");

2.25");

2.00");

1.75");

1.50");

1.25");

1.75");

}
else
Console.Write("Error message: Invalid grade value");
Console.ReadKey();
}
}

==================================================
==================================================
==================================================
==================================================
class Program
{
static void Main(string[] args)
{
int grade;
Console.Write("Enter gradevalue: ");
grade = Convert.ToInt32(Console.ReadLine());
if ((grade >= 50) && (grade <= 100))
{
if ((grade >= 50) && (grade <= 74)) {
Console.WriteLine("Decimal equivalent:
Console.WriteLine("Remarks: FAILURE");
}
else if (grade == 75) {
Console.WriteLine("Decimal equivalent:
Console.WriteLine("Remarks: PASSED");
}
else if ((grade >= 76) && (grade <= 78))
Console.WriteLine("Decimal equivalent:
Console.WriteLine("Remarks: PASSED");
}
else if ((grade >= 79) && (grade <= 81))
{
Console.WriteLine("Decimal equivalent:
Console.WriteLine("Remarks: PASSED");
}
else if ((grade >= 82) && (grade <= 84))
{
Console.WriteLine("Decimal equivalent:
Console.WriteLine("Remarks: PASSED");
}
else if ((grade >= 85) && (grade <= 87))
{
Console.WriteLine("Decimal equivalent:
Console.WriteLine("Remarks: PASSED");
}
else if ((grade >= 88) && (grade <= 91))
{
Console.WriteLine("Decimal equivalent:
Console.WriteLine("Remarks: PASSED");
}
else if ((grade >= 92) && (grade <= 94))
{
Console.WriteLine("Decimal equivalent:
Console.WriteLine("Remarks: PASSED");
}
else if ((grade >= 95) && (grade <= 97))
{
Console.WriteLine("Decimal equivalent:
Console.WriteLine("Remarks: PASSED");
}

5.00");

3.00");
{
2.75");

2.50");

2.25");

2.00");

1.75");

1.50");

1.25");

else
{
Console.WriteLine("Decimal equivalent: 1.00");
Console.WriteLine("Remarks: PASSED");
}
}
else
Console.Write("Error message: Invalid grade value");
Console.ReadKey();
}
}

==================================================
==================================================
==================================================
==================================================
class Program
{
static void Main(string[] args)
{
Console.Write("Enter employee name: ");
string empName = Console.ReadLine();
Console.Write("Employee Status ([R]egular [J]ob Order [C]ontractual)
:");
char status = Convert.ToChar(Console.ReadLine().ToLower());
Console.WriteLine();
if ((status == 'r') || (status == 'j') || (status == 'c'))
{
if (status == 'r')
Console.WriteLine("Hi {0}! Your monthly earnings is 20,000.0
0", empName);
if (status == 'j')
Console.WriteLine("Hi {0}! Your monthly earnings is 15,000.0
0", empName);
if (status == 'c')
Console.WriteLine("Hi {0}! Your monthly earnings is 10,000.0
0", empName);
}
else
Console.WriteLine("Error message: Invalid employee status!");
Console.ReadKey();
}
}

==================================================

==================================================
==================================================
==================================================
class Program
{
static void Main(string[] args)
{
Console.Write("Enter employee name: ");
string empName = Console.ReadLine();
Console.Write("Employee Status ([R]egular [J]ob Order [C]ontractual)
:");
string status = Console.ReadLine().ToLower();
Console.WriteLine();
if (status.Equals("r"))
Console.WriteLine("Hi {0}! Your monthly earnings is 20,000.0
0", empName);
else if (status.Equals("j"))
Console.WriteLine("Hi {0}! Your monthly earnings is 15,000.0
0", empName);
else if (status.Equals("c"))
Console.WriteLine("Hi {0}! Your monthly earnings is 10,000.0
0", empName);
else
Console.WriteLine("Error message: Invalid employee status!")
;
Console.ReadKey();
}
}

==================================================
==================================================
==================================================
==================================================
using
using
using
using

System;
System.Collections.Generic;
System.Linq;
System.Text;

namespace ConsoleApplication52
{
class Program
{
static void Main(string[] args)
{
Console.Write("Enter employee name: ");
string empName = Console.ReadLine();
Console.Write("Employee Status ([R]egular [J]ob Order [C]ontractual)
:");
char status = Convert.ToChar( Console.ReadLine().ToLower());
Console.WriteLine();

switch (status)
{
case 'r':
Console.WriteLine("Hi {0}! Your monthly earnings is 20,000.0
0", empName);
break;
case 'j':
Console.WriteLine("Hi {0}! Your monthly earnings is 15,000.0
0", empName);
break;
case 'c':
Console.WriteLine("Hi {0}! Your monthly earnings is 10,000.0
0", empName);
break;
default:
Console.WriteLine("Error message: Invalid employee status!")
;
break;
}
Console.ReadKey();
}
}
}

==================================================
==================================================
==================================================
==================================================
using
using
using
using

System;
System.Collections.Generic;
System.Linq;
System.Text;

namespace ConsoleApplication52
{
class Program
{
static void Main(string[] args)
{
int inNum, ctr, pos = 0, neg = 0;
ctr = 1;
while (ctr <= 10)
{
Console.Write("Enter integer value {0}: ", ctr);
inNum = Convert.ToInt32(Console.ReadLine());
if (inNum >= 0)
pos++;
if (inNum < 0)
neg++;
ctr++;

}
Console.WriteLine();
Console.WriteLine("Number of Positive values: " + pos.ToString());
Console.WriteLine("Number of Negative values: " + neg.ToString());
Console.ReadKey();
}
}
}

==================================================
==================================================
==================================================
==================================================
class Program
{
static void Main(string[] args)
{
int inNum;
string pos = "", neg = "";
do
{
Console.Write("Enter integer value: ");
inNum = Convert.ToInt32(Console.ReadLine());
if (inNum > 0)
pos += inNum + "\t";
if (inNum < 0)
neg += inNum + "\t";
} while (inNum != 0);
Console.WriteLine();
Console.WriteLine("List of all positive values: " + pos);
Console.WriteLine("List of all negative values: " + neg);
Console.ReadKey();
}
}

==================================================
==================================================
==================================================
==================================================
using
using
using
using

System;
System.Collections.Generic;
System.Linq;
System.Text;

namespace ConsoleApplication52

{
class Program
{
static void Main(string[] args)
{
int inNum;
string pos = "", neg = "";
do
{
Console.Write("Enter integer value: ");
inNum = Convert.ToInt32(Console.ReadLine());
if (inNum > 0)
pos += inNum + "\t";
if (inNum < 0)
neg += inNum + "\t";
} while (inNum != 0);
Console.WriteLine();
Console.WriteLine("List of all positive values: " + pos);
Console.WriteLine("List of all negative values: " + neg);
Console.ReadKey();
}
}
}

==================================================
==================================================
==================================================
==================================================
class Program
{
static void Main(string[] args)
{
int x, y, r, c;
Console.Write("Enter row size: ");
r = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter column size: ");
c = Convert.ToInt32(Console.ReadLine());
if (((r >= 1) && (r <= 10)) && ((c >= 1) && (c <= 10)))
{
Console.WriteLine();
Console.WriteLine("Press any key to genrate the multiplication t
able..");
Console.ReadKey();
Console.WriteLine();
x = 1;

do
{
y = 1;
do
{
Console.Write((x * y) + "\t");
y++;
} while (y <= c);
Console.WriteLine();
x++;
} while (x <= r);

}
else
{
Console.WriteLine("Error message: Invalid input value(s)..");
}
Console.ReadKey();
}
}
}

==================================================
==================================================
==================================================
==================================================
using
using
using
using

System;
System.Collections.Generic;
System.Linq;
System.Text;

namespace ConsoleApplication53
{
class Program
{
static void Main(string[] args)
{
string strInput;
int intNum;
Console.Write("Enter integer number that represents day of the week:
");
strInput = Console.ReadLine();
intNum = Convert.ToInt32(strInput);
switch (intNum) {
case 1:
Console.WriteLine("Day in word: Monday");
break;
case 2:
Console.WriteLine("Day in word: Tuesday");
break;
case 3:

Console.WriteLine("Day in word: Wednesday");


break;
case 4:
Console.WriteLine("Day in word: Thursday");
break;
case 5:
Console.WriteLine("Day in word: Friday");
break;
case 6:
Console.WriteLine("Day in word: Saturday");
break;
case 7:
Console.WriteLine("Day in word: Sunday");
break;
default:
Console.WriteLine("Error message: Invalid input value..");
break;
}
Console.ReadKey();
}
}
}

==================================================
==================================================
==================================================
==================================================
using
using
using
using

System;
System.Collections.Generic;
System.Linq;
System.Text;

namespace ConsoleApplication53
{
class Program
{
static void Main(string[] args)
{
int num;
Console.Write("Enter integer number: ");
num = Convert.ToInt32(Console.ReadLine());
if (num >= 0)
Console.WriteLine("Result: {0} is a positive value.", num);
else
Console.WriteLine("Result: {0} is a negative value.", num);
Console.ReadKey();
}
}
}

==================================================
==================================================
==================================================
==================================================
using
using
using
using

System;
System.Collections.Generic;
System.Linq;
System.Text;

namespace ConsoleApplication53
{
class Program
{
static void Main(string[] args)
{
int g;
Console.Write("Enter grade value: ");
g = Convert.ToInt32(Console.ReadLine());
if ((g >= 50) && (g <= 100))
{
switch (g)
{
case 50: case 51: case 52: case 53: case 54: case 55: case 56
: case 57: case 58: case 59: case 60: case 61: case 62: case 63: case 64: case 6
5: case 66: case 67: case 68: case 69: case 70: case 71: case 72: case 73: case
74:
Console.WriteLine("Decimal equivalent: 5.00");
Console.WriteLine("Remarks: FAILURE");
break;
case 75:
Console.WriteLine("Decimal equivalent: 3.00");
Console.WriteLine("Remarks: PASSED");
break;
case 76: case 77: case 78:
Console.WriteLine("Decimal equivalent: 2.75");
Console.WriteLine("Remarks: PASSED");
break;
case 79: case 80: case 81:
Console.WriteLine("Decimal equivalent: 2.50");
Console.WriteLine("Remarks: PASSED");
break;
case 82: case 83: case 84:
Console.WriteLine("Decimal equivalent: 2.25");
Console.WriteLine("Remarks: PASSED");

break;
case 85: case 86: case 87:
Console.WriteLine("Decimal equivalent: 2.00");
Console.WriteLine("Remarks: PASSED");
break;
case 88: case 89: case 90:
Console.WriteLine("Decimal equivalent: 1.75");
Console.WriteLine("Remarks: PASSED");
break;
case 91: case 92: case 93:
Console.WriteLine("Decimal equivalent: 1.50");
Console.WriteLine("Remarks: PASSED");
break;
case 94: case 95: case 96:
Console.WriteLine("Decimal equivalent:1.25");
Console.WriteLine("Remarks: PASSED");
break;
case 97: case 98: case 99: case 100:
Console.WriteLine("Decimal equivalent: 1.00");
Console.WriteLine("Remarks: PASSED");
break;

}
}
else
{
Console.WriteLine("Error message: Out of range!");
}
Console.ReadKey();
}
}
}

==================================================
==================================================
==================================================
==================================================
using
using
using
using

System;
System.Collections.Generic;
System.Linq;
System.Text;

namespace ConsoleApplication53
{
class Program
{
static void Main(string[] args)
{

string empName, status;


Console.Write("Enter employee name: ");
empName = Console.ReadLine();
Console.Write("Employee's status([R]egular [J]ob Order [C]ontractual
): ");
status = Console.ReadLine();
Console.WriteLine();
if ((status == "r") || (status == "R"))
Console.WriteLine("Hi " + empName + "! Your monthly earnings is
20,000.00");
if ((status == "j") || (status == "J"))
Console.WriteLine("Hi " + empName + "! Your monthly earnings is
15,000.00");
if ((status == "c") || (status == "C"))
Console.WriteLine("Hi " + empName + "! Your monthly earnings is
10,000.00");

Console.ReadKey();
}
}
}

==================================================
==================================================
==================================================
==================================================
using
using
using
using

System;
System.Collections.Generic;
System.Linq;
System.Text;

namespace ConsoleApplication53
{
class Program
{
static void Main(string[] args)
{
string empName;
char status;
Console.Write("Enter employee name: ");
empName = Console.ReadLine();
Console.Write("Employee's status([R]egular [J]ob Order [C]ontractual
): ");

status = Convert.ToChar(Console.ReadLine());
Console.WriteLine();
if ((status == 'r') || (status == 'R'))
Console.WriteLine("Hi " + empName + "! Your monthly earnings is
20,000.00");
if ((status == 'j') || (status == 'J'))
Console.WriteLine("Hi " + empName + "! Your monthly earnings is
15,000.00");
if ((status == 'c') || (status == 'C'))
Console.WriteLine("Hi " + empName + "! Your monthly earnings is
10,000.00");

Console.ReadKey();
}
}
}

==================================================
==================================================
==================================================
==================================================

using
using
using
using

System;
System.Collections.Generic;
System.Linq;
System.Text;

namespace ConsoleApplication53
{
class Program
{
static void Main(string[] args)
{
string empName, status;
Console.Write("Enter employee name: ");
empName = Console.ReadLine();
Console.Write("Employee's status([R]egular [J]ob Order [C]ontractual
): ");
status = Console.ReadLine().ToLower();
Console.WriteLine();
if (status.Equals("r"))
Console.WriteLine("Hi " + empName + "! Your monthly earnings is

20,000.00");
if (status.Equals("j"))
Console.WriteLine("Hi " + empName + "! Your monthly earnings is
15,000.00");
if (status.Equals("c"))
Console.WriteLine("Hi " + empName + "! Your monthly earnings is
10,000.00");

Console.ReadKey();
}
}
}

==================================================
==================================================
==================================================
==================================================
using
using
using
using

System;
System.Collections.Generic;
System.Linq;
System.Text;

namespace ConsoleApplication53
{
class Program
{
static void Main(string[] args)
{
int num, cPos = 0, cNeg = 0, x;
for (x = 1; x <= 10; x++)
{
Console.Write("Enter integer number: ");
num = Convert.ToInt32(Console.ReadLine());
if (num >= 0)
cPos++; // cPos +=; cPos = cPos + 1;
if (num < 0)
cNeg++;
}
Console.WriteLine("Number of postive values: " + cPos);
Console.WriteLine("Number of negative values: " + cNeg);
Console.ReadKey();
}
}
}

==================================================
==================================================
==================================================
==================================================
using
using
using
using

System;
System.Collections.Generic;
System.Linq;
System.Text;

namespace ConsoleApplication53
{
class Program
{
static void Main(string[] args)
{
int num;
string cPos = " ", cNeg = " ";

do
{
Console.Write("Enter integer number: ");
num = Convert.ToInt32(Console.ReadLine());
if (num > 0)
cPos += num + "\t";
if (num < 0)
cNeg += num + "\t";
} while (num != 0);
Console.WriteLine("List of positive values: " + cPos);
Console.WriteLine("List of negative values: " + cNeg);
Console.ReadKey();
}
}
}

==================================================
==================================================
==================================================
==================================================

using
using
using
using

System;
System.Collections.Generic;
System.Linq;
System.Text;

namespace ConsoleApplication53
{
class Program
{
static void Main(string[] args)
{
int row, col, r, c;
Console.Write("Enter row size: ");
row = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter column size: ");
col = Convert.ToInt32(Console.ReadLine());
Console.WriteLine();
Console.WriteLine("Press any key to generate the multiplication tabl
e..");
Console.ReadKey();
Console.WriteLine();
for (r = 1; r <= row; r++)
{
for (c = 1; c <= col; c++)
{
Console.Write((r * c) + "\t");
}
Console.WriteLine("");
}

Console.ReadKey();
}
}
}

==================================================
==================================================
==================================================
==================================================

==================================================
==================================================
==================================================
==================================================

==================================================
==================================================
==================================================
==================================================

==================================================
==================================================
==================================================
==================================================

==================================================
==================================================
==================================================
==================================================

==================================================
==================================================
==================================================
==================================================

You might also like