C# Loop Programming Examples

example
In this chapter you will learn:

In this chapter you will learn how to implement loop constructs in C# programming. There are some programming examples are given below that will help you to understand loop constructs in C#.

Qu 1: Write a program to display table of given number.
Answer:

Output

Enter a number     8
8 x 1 = 8
8 x 2 = 16
8 x 3 = 24
8 x 4 = 32
8 x 5 = 40
8 x 6 = 48
8 x 7 = 56
8 x 8 = 64
8 x 9 = 72
8 x 10 = 80
__

 

Qu2: Write a program to print following output using for loop.
1
22
333
4444
55555



  • Answer:

    Output

    1
    22
    333
    4444
    55555
    __

    Summary

    In this chapter you learned how to implement loop constructs in C# programming. In next chapter, you will get some
    programming exercises. You must do all the exercises in order to improve your programming skills in loop constructs.


    31 thoughts on “C# Loop Programming Examples”

    1. Any one can print this program if yes plz send the code to me —> [email protected]

          1. Paste this below code, in the above program, below the comment “//Continue here”. Because I couldn’t post full code at once.

    2. 2

      **

      **

      3

      ***

      *-*

      ***

      4

      ****

      *–*

      *–*

      ****

      5

      *****

      *—*

      *—*

      *—*

      *****

      6

      ******

      *—-*

      *—-*

      *—-*

      *—-*

      ******

      7

      *******

      *—–*

      *—–*

      *—–*

      *—–*

      *—–*

      *******

      8

      ********

      *——*

      *——*

      *——*

      *——*

      *——*

      *——*

      ********

    3. Guys I want this in for loop and while loop
      In C sharp

      And

      Pls help me and send me the code

      1. Hi. This is the solution or first one.

    4. Guys help me
      I need this output in c sharp

      I need these two from for loop and do while loop
      Pls send coding on this comment or on my messenger
      Name=Huzaifa Motiwala

    5. how to solve Print

    6. Hello Guys ! Can anyone plz check my code and tell me what is wrong. I want to print this pattern but i get a wrong pattern.

      +*+
      +**+
      +***+
      +****+
      +*****+
      +******+
      +*******+
      +********+
      +*********+
      +**********+
      my code is like this

    7. write a c# programs to display the numbers in the following
      formats
      a.)
      4 4
      3 3 3 3
      2 2 2 2 2 2
      1 1 1 1 1 1 1 1
      0 0 0 0 0 0 0 0 0
      1 1 1 1 1 1 1
      2 2 2 2 2
      3 3 3
      4

      b.)
      12344321
      123 321
      12 21
      1 1

    Leave a Reply

    Your email address will not be published. Required fields are marked *