aaaaaaaaaaaaaaaaa
for(initialise counter; test counter; increment counter)
{
do this;
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
int c;
for (c = 0; c <= 10; c++) //'c' value is 0, loop looping when 'c' value less then or equal
//to 10, and incrementing, U also write 'for(int c = 0; c <= 10; c++)'
Console.WriteLine(c); //it printing 1 to 10 integers.
Console.ReadLine();
} //for decrement Use 'c--' on 'c++'.
}
}
// 'initialization, repetition condition and incrementing' are all include in for structure.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
int a;
for (a = 0; a <= 10; a++)
{
Console.WriteLine(a); //it showing from 0 to 5 bcz if statement
if (a == 5) //checking when 'a' value is equal to 5 then
break; //'break' statement break the process.
} //if U write 'Console.WriteLine(a);' after break statement then it
Console.ReadLine(); //printing from 0 to 4 bcz when 'a' equal
} //to 5 it breaking then process.
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
int a;
for (a = 0; a <= 10; a++)
{ //it printing from 0 to 10 without 5 like 01234678910 'if statement'
if (a == 5) //checking, if 'a' value equal to 5 then
continue; //'continue' statement will skip 5 and printing
Console.WriteLine(a); //another all.
}
Console.ReadKey();
}
}
}