Q:

C# | Print numbers from 1 to 15 using do while loop

belongs to collection: C# Basic Programs | Looping programs

0

C# | Print numbers from 1 to 15 using do while loop

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Program:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Loop2
{
	class Program
	{
		static void Main(string[] args)
		{
			int a;
			a = 1;
			do
			{
				Console.WriteLine(a);
				a++;
			} while (a <= 15);
			//wait to hit any key to exit the program
			Console.ReadKey();
		}
	}
}

Output

1
2
3
4
5
6
7
8
9
10 
11 
12 
13 
14 
15 

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C# program to find out the prime numbers among 2 t... >>
<< C# | Print numbers from 1 to 15 using while loop...