answersLogoWhite

0

// Examples of five Loop structures in C#

// Each one iterates over the characters in a string, and writes

// them to the Console.

string s = "This is a test";

// For Loop

for (int i=0; i<s.Length; i++) Console.Write (s[i]);

// Foreach Loop

foreach (char c in s) Console.Write (c);

// While Loop

int i=0;

while (i<s.Length) Console.Write(s[i++]);

// Do Loop

int j=0;

do Console.Write(s[j++]) while j<s.Length;

// Spaghetti Code

int k=0;

loop: Console.Write(s[k++]);

if (k<s.Length) goto loop;

User Avatar

Wiki User

11y ago

What else can I help you with?

Related Questions

The while loop is a type of loop?

Is loop


What is a loop type?

A Loop is a programming language construct that instructs the processor to repeat a sequence of operations a number of times until a specific condition is reached. There are different types of loops. They are: * for loop * while loop * do while loop


What is the loop called for a group of atoms bonded together to form a closed loop in a molecule?

This type of loop is called a ring or cyclic structure. It occurs when atoms are bonded in a way that creates a closed loop within a molecule. This can lead to the formation of various types of cyclic compounds in organic chemistry.


Which type of lipid is a ring structure classification?

Steroids are a type of lipid that have a ring structure. Hormones like cholesterol and sex hormones are examples of steroids.


Are mold and yeast examples of angiosperms?

No, mold and yeast are not examples of angiosperms. Angiosperms are flowering plants that produce seeds within a fruiting structure. Mold and yeast belong to different kingdoms and are not classified as angiosperms. Mold is a type of fungus, while yeast is a type of single-celled fungi.


Definition of do loop while in visual basic?

There are 3 type of loop 1 is for loop 2 is loop while 3 is loop untile


What type of loop can either increment or decrement the loop control variables value?

Counting Loop


Where D-loop replication is done?

D-loop replication occurs during the process of DNA repair in the mitochondria. This type of replication involves the formation of a displacement loop (D-loop) structure, which allows for the repair of damaged mitochondrial DNA by DNA polymerases.


Why array is differ from structure?

An array is an aggregate of the same type. A structure is an aggregate of different types.


What is a nested loop in java?

A nested loop is a (inner) loop that appears in the loop body of another (outer) loop. The inner or outer loop can be any type: while, do while, or for. For example, the inner loop can be a while loop while an outer loop can be a for loop.


What is a sentenial loop?

It is a type of event controlled loop which is goes on until it strikes a value which is predefined to stop the loop.


What are the different type of control structure in visual basic?

deleting control