####Problem NUMBER 1
using System;
using [Link];
using [Link];
using [Link];
namespace application2
{
class Program
{
static void Main(string[] args)
{
int i;
i= Convert.ToInt32([Link]());
if (i >= 0)
{
[Link]("Integer value: Positive");
[Link]();
}
}
}
###Problem Number2
using System;
using [Link];
using [Link];
using [Link];
namespace application2
{
class Program
{
static void Main(string[] args)
{
int i;
i= Convert.ToInt32([Link]());
if (i <0)
{
[Link]("Integer value: Negative");
[Link]();
}
}
}
#######Problem 3
using System;
using [Link];
using [Link];
using [Link];
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
int m = Convert.ToInt32([Link]());
if (m == 1)
[Link]("Result: January");
if (m == 2)
[Link]("Result: Febraury");
if (m == 3)
[Link]("Result: March");
if (m == 4)
[Link]("Result: April");
if (m == 5)
[Link]("Result: May");
if (m == 6)
[Link]("Result: June");
if (m == 7)
[Link]("Result: July");
if (m == 8)
[Link]("Result: August");
if (m == 9)
[Link]("Result: September");
if (m == 10)
[Link]("Result: October");
if (m == 11)
[Link]("Result: November");
if (m == 12)
[Link]("Result: December");
[Link]();
}
}
}
IF ELSE STATEMENT
##########Problem 4
using System;
using [Link];
using [Link];
using [Link];
namespace application4
{
class Program
{
static void Main(string[] args)
{
int i;
i= Convert.ToInt32([Link]());
if (i >= 0)
[Link]("Integer value: Positive");
else
[Link]("Integer value: Negative");
[Link]();
}
}
}
########Problem 5
using System;
using [Link];
using [Link];
using [Link];
namespace application4
{
class Program
{
static void Main(string[] args)
{
int i;
i= Convert.ToInt32([Link]());
if (i == 0)
[Link]("False");
else
[Link]("True");
[Link]();
}
}
}
############Problem 6
using System;
using [Link];
using [Link];
using [Link];
namespace application4
{
class Program
{
static void Main(string[] args)
{
int n1, n2;
[Link]("Input First Number:");
n1= Convert.ToInt32([Link]());
[Link]("Input Second Number:");
n2= Convert.ToInt32([Link]());
if (n1 == n2)
[Link]("Equivalent");
else
[Link]("Not Equal");
[Link]();
}
}
}
IF ESLEIF ELSE
##############1
using System;
using [Link];
using [Link];
using [Link];
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
int m = Convert.ToInt32([Link]());
if (m == 1)
[Link]("Result: January");
else if (m == 2)
[Link]("Result: Febraury");
else if (m == 3)
[Link]("Result: March");
else if (m == 4)
[Link]("Result: April");
else if (m == 5)
[Link]("Result: May");
else if (m == 6)
[Link]("Result: June");
else if (m == 7)
[Link]("Result: July");
else if (m == 8)
[Link]("Result: August");
else if (m == 9)
[Link]("Result: September");
else if (m == 10)
[Link]("Result: October");
else if (m == 11)
[Link]("Result: November");
else if (m == 12)
[Link]("Result: December");
[Link]();
}
}
}
##############Problem 2
using System;
using [Link];
using [Link];
using [Link];
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
int m = Convert.ToInt32([Link]());
if (m == 1)
[Link]("Result: Winter");
else if (m == 2)
[Link]("Result: Winter");
else if (m == 3)
[Link]("Result: Winter");
else if (m == 4)
[Link]("Result: Spring");
else if (m == 5)
[Link]("Result: Spring");
else if (m == 6)
[Link]("Result: Spring");
else if (m == 7)
[Link]("Result: Summer");
else if (m == 8)
[Link]("Result: Summer");
else if (m == 9)
[Link]("Result: Summer");
else if (m == 10)
[Link]("Result: Autumn");
else if (m == 11)
[Link]("Result: Autumn");
else if (m == 12)
[Link]("Result: Autumn");
[Link]();
}
}
}
#################Problem 3
using System;
using [Link];
using [Link];
using [Link];
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
int d = Convert.ToInt32([Link]());
if (d == 1)
[Link]("Result: Weekday");
else if (d == 2)
[Link]("Result: Weekday");
else if (d == 3)
[Link]("Result: Weekday");
else if (d == 4)
[Link]("Result: Weekday");
else if (d == 5)
[Link]("Result: Weekday");
else if (d == 6)
[Link]("Result: Weekday");
else if (d == 7)
[Link]("Result: Weekday");
else
[Link]("Weekend");
[Link]();
}
}
}
#########Problem 4
using System;
using [Link];
using [Link];
using [Link];
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
int d = Convert.ToInt32([Link]());
if (d == 1)
[Link]("Result: Monday");
else if (d == 2)
[Link]("Result: Tuesday");
else if (d == 3)
[Link]("Result: Wenesday");
else if (d == 4)
[Link]("Result: Thursday");
else if (d == 5)
[Link]("Result: Friday");
else if (d == 6)
[Link]("Result: Saturday");
else if (d == 7)
[Link]("Result: Sunday");
[Link]();
}
}
}
LOOPING
For Loop
using System;
using [Link];
using [Link];
using [Link];
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
for (int i = 10; i > 0; i--)
{
[Link]("Value of i ; {0}", i);
}
[Link]();
}
}
}
While Loop
using System;
using [Link];
using [Link];
using [Link];
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
int i = 10;
while (i > 0)
{
[Link]("Value of i ; {0}", i);
i--;
}
[Link]();
}
}
}
Do While Loop
using System;
using [Link];
using [Link];
using [Link];
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
int i = 10;
do
{
[Link]("Value of i ; {0}", i);
i--;
} while (i > 0);
[Link]();
}
}
}
Problem 6
using System;
using [Link];
using [Link];
using [Link];
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
[Link]("Enter First Number:");
int n1 = Convert.ToInt32([Link]());
[Link]("Enter Second Number:");
int n2 = Convert.ToInt32([Link]());
[Link]("Enter Third Number:");
int n3 = Convert.ToInt32([Link]());
[Link]("Enter Fourth Number:");
int n4 = Convert.ToInt32([Link]());
[Link]("Enter Fifth Number:");
int n5 = Convert.ToInt32([Link]());
[Link]("Enter Sixth Number:");
int n6 = Convert.ToInt32([Link]());
[Link]("Enter Seventh Number:");
int n7 = Convert.ToInt32([Link]());
[Link]("Enter Eighth Number:");
int n8 = Convert.ToInt32([Link]());
[Link]("Enter Nineth Number:");
int n9 = Convert.ToInt32([Link]());
[Link]("Enter Tenth Number:");
int n10 = Convert.ToInt32([Link]());
[Link]("Sum is {0}", (n1 + n2 + n3 + n4 + n5 + n6 + n7 + n8 + n9 +
n10));
[Link]();
}
}
}
Problem 7