• Like

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.

Uploaded on

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,438
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
30
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. namespace ConsoleApplication15<br />{<br /> class Program<br /> {<br /> static void Main(string[] args)<br /> {<br /> Console.Write(" a too: " );<br /> int a = int.Parse(Console.ReadLine());<br /> Console.Write(" b too: " );<br /> int b = int.Parse(Console.ReadLine());<br /> Console.Write(" c too: " );<br /> int c = int.Parse(Console.ReadLine());<br /> if (a > b)<br /> if (b > c)<br /> Console.WriteLine(" min: c too {0}" , c);<br /> else<br /> Console.WriteLine(" min: b too {0}" , b);<br /> else if (a>c)<br /> Console.WriteLine(" min: c too {0}" , c);<br /> else<br /> Console.WriteLine(" min: a too {0}" , a); <br /> Console.ReadLine();<br /> }<br /> }<br />}<br />namespace ConsoleApplication17<br />{<br /> class Program<br /> {<br /> static void Main(string[] args)<br /> {<br /> Console.Write(" age: " );<br /> int a = int.Parse(Console.ReadLine());<br /> Console.WriteLine(" sex: " );<br /> string k = Console.ReadLine();<br /> <br /> if ((a >= 18) && ( k == " er" ))<br /> Console.Write(" tseregt yvj bolno" );<br /> else<br /> Console.Write(" tseregt yvj bolohgui" );<br /> Console.ReadLine();<br /> }<br /> }<br />}<br />namespace ConsoleApplication18<br />{<br /> class Program<br /> {<br /> <br /> <br /> static void Main(string[] args)<br /> {<br /> int s = 1;<br /> Console.Write(" n!: " );<br /> int n = int.Parse(Console.ReadLine());<br /> for (int i = 1; i <= n; i++)<br /> s *= i;<br /> Console.WriteLine(s);<br /> Console.ReadLine();<br /> <br /> }<br /> }<br />}<br />namespace ConsoleApplication23<br />{<br /> class Program<br /> {<br /> static void Main(string[] args)<br /> {<br /> Console.WriteLine(" N ширхэг тооны нийлбэр олох" );<br /> Console.Write(" N тоог оруулна уу: " );<br /> int n=int.Parse(Console.ReadLine());<br /> int s = 0;<br /> for (int i = 1; i <= n; i++)<br /> {<br /> Console.Write(" {0}-р тоог оруулна уу: " , i);<br /> s += (int.Parse(Console.ReadLine()));<br /> }<br /> Console.WriteLine(" {0} ширхэг тооны нийлбэр: {1} " ,n,s);<br /> Console.ReadLine();<br /> }<br /> }<br />}<br />namespace ConsoleApplication25<br />{<br /> class Program<br /> {<br /> static void Main(string[] args)<br /> {<br /> string[] temdegtmassiv;<br /> temdegtmassiv = new string[100];<br /> Console.WriteLine(" neg hemjeest massiviin gishuudiig oruul: " );<br /> int n = int.Parse(Console.ReadLine());<br /> for (int i = 1; i <= n; i++)<br /> {<br /> Console.Write(" {0}-r gishuunii utga oruulna uu: " , i);<br /> temdegtmassiv[i] = Console.ReadLine();<br /> }<br /> foreach (string s in temdegtmassiv)<br /> Console.Write(s);<br /> Console.ReadLine();<br /> }<br /> }<br />}<br />namespace ConsoleApplication26<br />{<br /> class Program<br /> {<br /> static void Main(string[] args)<br /> {<br /> int[] massivA = new int[100];<br /> Console.WriteLine(" neg hemjeest massiviin gishuudiig oruul: " );<br /> int n = int.Parse(Console.ReadLine());<br /> int s=0;<br /> for (int i = 1; i <= n; i++)<br /> {<br /> Console.Write(" {0}-r gishuunii utga oruulna uu: " , i);<br /> massivA[i] = int.Parse(Console.ReadLine());<br /> s += massivA[i];<br /> }<br /> Console.Write(" niilber{0}" ,s);<br /> Console.ReadLine();<br /> <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 /> 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 />