Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

Bodlogo

on

  • 941 views

 

Statistics

Views

Total Views
941
Views on SlideShare
940
Embed Views
1

Actions

Likes
0
Downloads
12
Comments
0

1 Embed 1

http://csharporgil.blogspot.com 1

Accessibility

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Bodlogo Bodlogo Presentation Transcript

      • Өгөгдсөн тоог хөрвүүлэх
      namespace ConsoleApplication32<br />{<br /> class Program<br /> {<br /> static void Main(string[] args)<br /> {<br /> string s = Console.ReadLine(); <br /> string k = " " ;<br /> int j = s.Length-1;<br /> for (int i = 0; i < s.Length; i++)<br /> { <br /> k=k.Insert(i,s.Substring(j, 1));<br /> j--;<br /> } <br /> Console.WriteLine(k);<br /> Console.ReadLine();<br /> }<br /> }<br />}<br />
      • Өгөгдсөн тоо палиндром тоо эсэх
      namespace ConsoleApplication32<br />{<br /> class Program<br /> {<br /> static void Main(string[] args)<br /> {<br /> string s = Console.ReadLine(); <br /> string k = " " ;<br /> int j = s.Length-1;<br /> for (int i = 0; i < s.Length; i++)<br /> { <br /> k=k.Insert(i,s.Substring(j, 1));<br /> j--;<br /> }<br /> if (int.Parse(s) == int.Parse(k)) <br /> Console.WriteLine(" palindrom mon" );<br /> else<br /> Console.WriteLine(" palindrom bish" );<br /> Console.ReadLine();<br /> }<br /> }<br />}<br />
      • Өгөгдсөн тоо тэгш эсвэл сондгой эсэхийг тодорхойлох
      namespace ConsoleApplication34<br />{<br /> class Program<br /> {<br /> static void Main(string[] args)<br /> {<br /> double m = double.Parse(Console.ReadLine()); <br /> string s=Convert.ToString(m/2);<br /> if (s.Contains(" ." ))<br /> Console.WriteLine(" sondgoi" );<br /> else<br /> Console.WriteLine(" tegsh" ); <br /> Console.ReadLine(); <br /> }<br /> }<br />}<br />Өгөгдсөн тооны цифрийн нийлбэр тэгш эсвэл сондгой эсэхийг тодорхойлох <br />namespace ConsoleApplication40<br />{<br /> class Program<br /> {<br /> static void Main(string[] args)<br /> {<br /> Console.Write(" too oruul=" );<br /> string m = Console.ReadLine();<br /> double s = 0;<br /> for (int i = 0; i < m.Length; i++)<br /> s += double.Parse(m.Substring(i,1));<br /> string k = Convert.ToString(s / 2);<br /> if (k.Contains(" ." ))<br /> Console.WriteLine(" tsifriin niilber {0}, sondgoi too" ,s );<br /> else<br /> Console.WriteLine(" tsifriin niilber {0}, tegsh too" , s);<br /> Console.ReadLine(); <br /> }<br /> }<br />}<br />
      • Өгөгдсөн a[1],a[2],a[3],… a[n] нэг хэмжээст массивын элементүүдийг хөрвүүлж b[1],b[2],b[3],… b[n] массивт хий.
      namespace ConsoleApplication35<br />{<br /> class Program<br /> {<br /> static void Main(string[] args)<br /> {<br /> int[] a = new int[100];<br /> int[] b = new int[100];<br /> Console.Write(" a massiviin elementiin too:=" );<br /> int n =int.Parse(Console.ReadLine());<br /> <br /> for (int i = 1; i <= n; i++)<br /> {<br /> Console.Write(" a[{0}]:=" , i);<br /> a[i] = int.Parse(Console.ReadLine()); <br /> }<br /> <br /> int t = n;<br /> for (int i = 1; i <= n; i++)<br /> {<br /> b[i] = a[t];<br /> t--;<br /> }<br /> for (int i = 1; i <= n; i++) <br /> Console.WriteLine(" b[{0}]:={1}" , i, b[i]); <br /> <br /> Console.ReadLine();<br /> }<br /> }<br />}<br />
      • Өгөгдсөн a[1],a[2],a[3],… a[n] нэг хэмжээст массивын элементүүдийг багаас нь ихрүү өсөх дарааллаар эрэмбэл.
      namespace ConsoleApplication36<br />{<br /> class Program<br /> {<br /> static void Main(string[] args)<br /> {<br /> int[] a = new int[100];<br /> <br /> Console.Write(" a massiviin elementiin too:=" );<br /> int n = int.Parse(Console.ReadLine());<br /> for (int i = 1; i <= n; i++)<br /> {<br /> Console.Write(" a[{0}]:=" , i);<br /> a[i] = int.Parse(Console.ReadLine());<br /> }<br /> int k=0;<br /> for (int i = 1; i < n; i++)<br /> for (int j = i+1; j <= n; j++) <br /> if (a[i] > a[j])<br /> {<br /> k = a[i];<br /> a[i] = a[j];<br /> a[j] = k;<br /> }<br /> for (int i = 1; i <= n; i++)<br /> Console.WriteLine(" a[{0}]:={1}" , i, a[i]);<br /> Console.ReadLine();<br /> }<br /> }<br />}<br />
      • Өгөгдсөн a[1],a[2],a[3],… a[n] нэг хэмжээст массиваас хамгийн их утгыг ол.
      namespace ConsoleApplication37<br />{<br /> class Program<br /> {<br /> static void Main(string[] args)<br /> {<br /> int[] a = new int[100];<br /> <br /> Console.Write(" a massiviin elementiin too:=" );<br /> int n = int.Parse(Console.ReadLine());<br /> for (int i = 1; i <= n; i++)<br /> {<br /> Console.Write(" a[{0}]:=" , i);<br /> a[i] = int.Parse(Console.ReadLine());<br /> }<br /> int max = a[1]; <br /> for (int i = 2; i <= n; i++) <br /> if (max < a[i]) <br /> max = a[i];<br /> <br /> Console.WriteLine(" hamgiin ih utga n: {0} " , max);<br /> Console.ReadLine();<br /> }<br /> }<br />}<br />
      • Өгөгдсөн a[1],a[2],a[3],… a[n] нэг хэмжээст массивт хамгийн их элемент хаана байгааг ол.
      namespace ConsoleApplication37<br />{<br /> class Program<br /> {<br /> static void Main(string[] args)<br /> {<br /> int[] a = new int[100];<br /> <br /> Console.Write(" a massiviin elementiin too:=" );<br /> int n = int.Parse(Console.ReadLine());<br /> for (int i = 1; i <= n; i++)<br /> {<br /> Console.Write(" a[{0}]:=" , i);<br /> a[i] = int.Parse(Console.ReadLine());<br /> }<br /> int max = a[1];<br /> int j=1;<br /> for (int i = 2; i <= n; i++) <br /> if (max < a[i])<br /> {<br /> max = a[i];<br /> j = i;<br /> } <br /> <br /> Console.WriteLine(" hamgiin ih utga n: a[{0}]={1}" , j, max);<br /> Console.ReadLine();<br /> }<br /> }<br />}<br />
      • Өгөгдсөн a[1],a[2],a[3],… a[n] нэг хэмжээст массивт m тоо хэдэн ширхэг байгааг тоол.
      namespace ConsoleApplication39<br />{<br /> class Program<br /> {<br /> static void Main(string[] args)<br /> {<br /> int[] a = new int[100];<br /> Console.Write(" a massiviin elementiin too:=" );<br /> int n = int.Parse(Console.ReadLine());<br /> Console.Write(" tentsuu too:=" );<br /> int m = int.Parse(Console.ReadLine());<br /> <br /> for (int i = 1; i <= n; i++)<br /> {<br /> Console.Write(" a[{0}]:=" , i);<br /> a[i] = int.Parse(Console.ReadLine());<br /> }<br /> <br /> int t=0;<br /> for (int i = 1; i <= n; i++)<br /> if (a[i] == m)<br /> t++;<br /> Console.WriteLine(" {0} too {1} shirheg bn," ,m,t);<br /> Console.ReadLine();<br /> }<br /> }<br />}<br />
      • Өгөгдсөн a[1],a[2],a[3],… a[n] нэг хэмжээст массивт хамгийн их элемент хаана хаана, хэдэн ширхэг байгааг тодорхойл.
      namespace ConsoleApplication37<br />{<br /> class Program<br /> {<br /> static void Main(string[] args)<br /> {<br /> int[] a = new int[100];<br /> <br /> Console.Write(" a massiviin elementiin too:=" );<br /> int n = int.Parse(Console.ReadLine());<br /> for (int i = 1; i <= n; i++)<br /> {<br /> Console.Write(" a[{0}]:=" , i);<br /> a[i] = int.Parse(Console.ReadLine());<br /> }<br /> int max = a[1]; <br /> for (int i = 2; i <= n; i++) <br /> if (max < a[i]) <br /> max = a[i];<br /> Console.WriteLine(" hamgiin ih utga n: {0} " , max);<br /> int t = 0;<br /> for (int i = 1; i <= n; i++)<br /> if (max == a[i])<br /> {<br /> t++;<br /> Console.WriteLine(" a[{0}] " , i);<br /> }<br /> Console.WriteLine(" {0} shirheg bn. " , t);<br /> Console.ReadLine();<br /> }<br /> }<br />}<br />namespace ConsoleApplication41<br />{<br /> class Program<br /> {<br /> static void Main(string[] args)<br /> {<br /> Console.Write(" Ortsnii toog oruul= " );<br /> int orts = int.Parse(Console.ReadLine());<br /> <br /> Console.Write(" Davhariin toog oruul= " );<br /> int Floor = int.Parse(Console.ReadLine());<br /> Console.Write(" Haalagnii dugaar oruul= " );<br /> int DoorNumber = int.Parse(Console.ReadLine());<br /> <br /> int t = 1;<br /> for (int i=1; i<=orts; i++)<br /> for (int j=1; j<=Floor; j++)<br /> for (int l = 1; l <= 3; l++)<br /> {<br /> if (DoorNumber == t)<br /> switch (l)<br /> {<br /> case 1:<br /> Console.WriteLine(" {0}-r orts, {1}-r Davhar, zuun haalga." , i, j, l);<br /> break;<br /> case 2:<br /> Console.WriteLine(" {0}-r orts, {1}-r Davhar, goliin haalga." , i, j, l);<br /> break;<br /> case 3:<br /> Console.WriteLine(" {0}-r orts, {1}-r Davhar, baruun haalga." , i, j, l);<br /> break; <br /> }<br /> t++;<br /> }<br /> Console.ReadLine();<br /> }<br /> }<br />}<br />