You are on page 1of 7

Coding: using using using using System; System.Collections.Generic; System.Linq; System.

Text;

namespace ConsoleApplication1 { class branch { static void Main(string[] args) { int a,b; Console .WriteLine ("Enter the values of a"); a=int.Parse (Console.ReadLine()); int[] n = new int[a]; Console.WriteLine("Enter the values"); for (b = 0; b < a; b++) { n[b] = int.Parse(Console.ReadLine()); } for (b = 0; b < a; b++) { if(n[b]%2==0) { Console.WriteLine(n[b]+"is EventArgs number"); } else{ Console.WriteLine(n[b]+"is odd no"); } Console.ReadLine(); } } } }

output

namespace dowhile { class Program { static void Main(string[] args) { int m1=0, m2=0, m3=0, m4=0, m5=0; float avg; int i, n=0, total=0, ch; Console.WriteLine("Student merit list"); Console.WriteLine("Enter the no of student"); n = int.Parse(Console.ReadLine()); Console.WriteLine("Enter the marks m1,m2,m3,m4,m5"); for (i = 0; i <= n; i++) { m1 = int.Parse(Console.ReadLine()); m2 = int.Parse(Console.ReadLine()); m3 = int.Parse(Console.ReadLine()); m4 = int.Parse(Console.ReadLine()); m5 = int.Parse(Console.ReadLine()); } for (i = 0; i < n; i++) { Console.WriteLine(m1); Console.WriteLine(m2); Console.WriteLine(m3); Console.WriteLine(m4); Console.WriteLine(m5); } Console.WriteLine("Enter the choice:"); Console.WriteLine("\t1.Total\n\t2.Average\n\t3.Exit"); ch = int.Parse(Console.ReadLine()); do { switch (ch) { case 1: total = m1 + m2 + m3 + m4 + m5; Console.WriteLine(total); break; case 2: avg = total / 5; break; default: Console.WriteLine("press 3 to exit"); break; } } while (ch != 3); Console.ReadLine(); } } }

using using using using

System; System.Collections.Generic; System.Linq; System.Text;

namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int n; n = int.Parse(Console.ReadLine()); Console.WriteLine(n); foreach (int i in n) { Console.WriteLine(i); if (n < 20) {

Console.WriteLine(" " + n); continue; } if (n == 30) { Console.WriteLine(); n = n + 10; continue; } if (n > 50) { break; Console.WriteLine(" " + n); n = n + 10; } Console.ReadLine(); } } } }

METHOD: using using using using System; System.Collections.Generic; System.Linq; System.Text;

namespace ConsoleApplication2 { class Passing { static void change(int m) { m = m + 20; } static void swap(ref int x, ref int y) { int temp = x; x = y; y = temp; } static void output(out int p) { p = 1000; } static void Main(string[] args) { int l = 100; change(l); Console.WriteLine("l=" + l); int a = 100, b = 200; Console.WriteLine("BEFORE SWAPPING"); Console.WriteLine("a=" + a); Console.WriteLine("b=" + b); swap(ref a, ref b); Console.WriteLine("AFTER SWAPPING"); Console.WriteLine("a=" + a); Console.WriteLine("b=" + b); int c; output(out c); } } }

You might also like