0% found this document useful (0 votes)
28 views

Program: 1.1 Namespace Class Static Void String Int

The document contains 3 code examples that take user input as integers, perform logical comparisons, and output results. The first example multiplies 4 user-input integers and displays the product. The second checks if one integer is greater than 10 and the other less than 10 or vice versa. The third uses a do-while loop to repeatedly take 2 integers as input, check if both are greater than 10, and break out of the loop to display the numbers if they pass the check.

Uploaded by

vipulsaluja
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

Program: 1.1 Namespace Class Static Void String Int

The document contains 3 code examples that take user input as integers, perform logical comparisons, and output results. The first example multiplies 4 user-input integers and displays the product. The second checks if one integer is greater than 10 and the other less than 10 or vice versa. The third uses a do-while loop to repeatedly take 2 integers as input, check if both are greater than 10, and break out of the loop to display the numbers if they pass the check.

Uploaded by

vipulsaluja
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

1.

1
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int a, b, c, d, prod;
Console.WriteLine("Enter 4 Integers");
a = Convert.ToInt32(Console.ReadLine());
b = Convert.ToInt32(Console.ReadLine());
c = Convert.ToInt32(Console.ReadLine());
d = Convert.ToInt32(Console.ReadLine());
prod = a * b * c * d;
Console.WriteLine("The product is {0}", prod);
Console.ReadLine();
}
}

1.2

using
using
using
using

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

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int var1, var2;
var1 = Convert.ToInt32(Console.ReadLine());
var2 = Convert.ToInt32(Console.ReadLine());

}
}

if ((var1 > 10 && var2 < 10) || (var1 < 10 && var2 > 10))
{
Console.WriteLine("Condition Satisfied");
}
Console.ReadLine();

1.3

using
using
using
using

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

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int var1, var2;
do
{
Console.WriteLine("Enter two numbers");
var1 = Convert.ToInt32(Console.ReadLine());
var2 = Convert.ToInt32(Console.ReadLine());
if ((var1 > 10 && var2 > 10))
{
Console.WriteLine("Rejected");
}
else
{
Console.WriteLine("The numbers entered are {0} and {1}", var1,
var2);
break;
}
}

while (true);
Console.ReadLine();
}
}

You might also like