flow management:- While loop/*Do while loop/for loop/
2) flow management:-
*While loop:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace While
{
class Program
{
static void Main(string[] args)
{
int i=1;
while(i<=10)
{
console.WriteLine(i);
}
Console.ReadKey();
}
}
}
*Do while loop:-
-Exit loop
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace doWhile
{
class Program
{
static void Main(string[] args)
{
int i = 1;
do
{
Console.WriteLine(i);
i = i + 1;
} while (i<= 10);
Console.ReadKey();
}
}
}
* for loop:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace doWhile
{
class Program
{
static void Main(string[] args)
{
int i;
for(i=1; i<=10; i++)
{
Console.WriteLine(i);
}
Console.ReadKey();
}
}
}
Task1:-
sum of 1 to 10 number
Task2:-
display 1 to 10 even number
Task3
1 to 10 odd number
Task4:-
input any number from the user and display table of given number
Task5:-
input any number from the user and display table of specific format
format -
2 * 1 = 2
2 * 2 = 4
2 * 3 = 6 ....
Comments
Post a Comment