System. Collections. Generic
Download 216.24 Kb.
|
2 5219800778486581107
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MASSIV { class Program { static void Main(string[] args) {//2-misol // a varianti Console.Write("n="); int n = Convert.ToInt32(Console.ReadLine()); char[] s = new char[n]; for(int i=0;i { Console.Write("x[{0}]=", i); s[i]=Convert.ToChar(Console.ReadLine()); } Console.WriteLine(s[1]); for (int i = 2; i < n; i++) { double a = i; for(int j=1;;j++) { a = a / 2; if (a == 1) { Console.WriteLine(s[i]); break; } if (a < 1) break; } } Console.ReadKey(); //b varianti for(int i=1;i { double b = Math.Sqrt(i); if (b * b == i) Console.WriteLine(s[i]); } Console.ReadLine(); //d varianti int k=1,m=1; for(int i=1;i { if (i == m) { Console.WriteLine(s[i]); int d = m; m = m + k; k = d; } } Console.ReadLine(); } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MASSIV { class Program { static void Main(string[] args) { //3-misol const int k = 5, m = 6, n = k + m; double[] x = new double[k]; for(int i=0;i { Console.Write("x[{0}]=", i); x[i] = Convert.ToDouble(Console.ReadLine()); } double[] y = new double[m]; for (int j = 0; j < m; j++) { Console.Write("y[{0}]=", j); y[j] = Convert.ToDouble(Console.ReadLine()); } double[] z = new double[n]; for (int i = 0, j = 0; i < k;i++,j++ ) { z[j] = x[i]; } for (int i = 0, j = k; i < m;i++,j++ ) { z[j] = y[i]; } for (int i = 0; i < n; i++) { double c = z[i]; for (int j = i; j < n; j++) { if (c <= z[j]) continue; else { double a = c; c = z[j]; z[j] = a; } } Console.WriteLine(c); } Console.ReadLine(); } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MASSIV { class Program { static void Main(string[] args) {//9-misol int min=0; Console.Write("n="); int n = Convert.ToInt32(Console.ReadLine()); int[] x = new int[n]; for (int i = 0; i < n; i++) { Console.Write("x[{0}]=", i); x[i] = Convert.ToInt32(Console.ReadLine()); } int[] y = new int[n]; for (int i = 0; i < n; i++) { Console.Write("y[{0}]=", i); y[i] = Convert.ToInt32(Console.ReadLine()); } int k = 0; for(int i=0;i { int s = 0; for(int j=0;j { if (x[i] == y[j]) s = s + 1; } if (s == 0) { k = k + 1; } else continue; if(k==1) { min = x[i]; } if (min <= x[i]) continue; else { int m = x[i]; x[i] = min; min = m; } } Console.WriteLine(min); Console.ReadLine(); } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MASSIV { class Program { static void Main(string[] args) {//6-misol //b varianti int sanagich = 0, a; int[] m = new int[10]; for(int i=0;i<10;i++) { Console.Write("m[{0}]=", i); m[i] = Convert.ToInt32(Console.ReadLine()); } for(int i=0;i<10;i++) { int c = m[i]; for(int j=0;;j++) { if (c == 0) break; if (c % 2 == 0) { c = c / 2; if (c == 1) sanagich = sanagich + 1; } else break; } } if (sanagich == 2) Console.WriteLine("true"); else Console.WriteLine("false"); Console.ReadLine(); } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MASSIV { class Program { static void Main(string[] args) {//11-misol Console.Write("matinni kiriting: "); string s = Console.ReadLine(); int n = s.Length; for(int i=0;i { char a = s[i]; for(int j=i+1;j { if(a==s[j]) { n = n - 1; } } } Console.WriteLine(n); Console.ReadLine(); } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MASSIV { class Program { static void Main(string[] args) {//8-misol Console.Write("n="); int n = Convert.ToInt32(Console.ReadLine()); double[] p = new double[n+1]; for(int i=0;i { Console.Write("p[{0}]=", i); p[i] = Convert.ToDouble(Console.ReadLine()); } Console.Write("a="); double a = Convert.ToDouble(Console.ReadLine()); Console.Write("p[0]="); Console.WriteLine(p[0]); for(int i=1;i { double s = p[i] - a * p[i - 1]; Console.Write("p[{0}]=", i); Console.WriteLine(s); } double m = -a * p[n]; Console.Write("p[{0}]=", n + 1); Console.WriteLine(m); Console.ReadLine(); } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MASSIV { class Program { enum oy { yan=1,fev=2,mart=1,apr=3,may=1,iyn=3,iyl=1,avg=1,sen=3,okt=1,noy=3,dek=1} static void Main(string[] args) {//5-misol int s = 0; int[] t = new int[365]; double[] m = new double[12]; for (int j = 0; j < 31; j++) { Random n = new Random(); t[j] = n.Next(-50, 15); s = s + t[j]; } m[0] = s / 31; s = 0; for (int j = 31; j < 59; j++) { Random n = new Random(); t[j] = n.Next(-30, 18); s = s + t[j]; } m[1] = s / 28; s = 0; for (int j = 59; j < 90; j++) { Random n = new Random(); t[j] = n.Next(-10, 25); s = s + t[j]; } m[2] = s / 31; s = 0; for (int j = 90; j < 120; j++) { Random n = new Random(); t[j] = n.Next(5, 25); s = s + t[j]; } m[3] = s / 30; s = 0; for (int j = 120; j < 151; j++) { Random n = new Random(); t[j] = n.Next(10, 30); s = s + t[j]; } m[4] = s / 31; s = 0; for (int j = 151; j < 181; j++) { Random n = new Random(); t[j] = n.Next(20, 35); s = s + t[j]; } m[5] = s / 30; s = 0; for (int j = 181; j < 212; j++) { Random n = new Random(); t[j] = n.Next(25, 45); s = s + t[j]; } m[6] = s / 31; s = 0; for (int j = 212; j < 243; j++) { Random n = new Random(); t[j] = n.Next(25, 45); s = s + t[j]; } m[7] = s / 31; s = 0; for (int j = 243; j < 273; j++) { Random n = new Random(); t[j] = n.Next(15, 25); s = s + t[j]; } m[8] = s / 30; s = 0; for (int j = 273; j < 304; j++) { Random n = new Random(); t[j] = n.Next(0, 20); s = s + t[j]; } m[9] = s / 31; s = 0; for (int j = 304; j < 334; j++) { Random n = new Random(); t[j] = n.Next(-5, 15); s = s + t[j]; } m[10] = s / 30; s = 0; for (int j = 334; j < 365; j++) { Random n = new Random(); t[j] = n.Next(-50, 15); s = s + t[j]; } m[11] = s / 31; double a = m[0]; for(int i=1;i<12;i++) { if(a<=m[i]) { double k = m[i]; m[i] = a; a = k; } } for(int i=0;i<12;i++) { if(a==m[i]) { Console.Write("m[{0}]=", i); Console.WriteLine(a); break; } } Console.ReadLine(); } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MASSIV { class Program { static void Main(string[] args) {//4-misol const int k = 9, n = 2; double X; char[] m = new char[k]; for (int i = 0; i < k; i++) { Console.Write("m[{0}]=", i); m[i] = Convert.ToChar(Console.ReadLine()); } char[] p = new char[n]; for (int j = 0; j < n; j++) { Console.Write("y[{0}]=", j); p[j] = Convert.ToChar(Console.ReadLine()); } string a = Convert.ToString(p[0]); int b = Convert.ToInt32(a); string a1 = Convert.ToString(p[1]); int b1 = Convert.ToInt32(a1); double son1 = b * 10 + b1; double son = Math.Pow(10, son1);// 10ning darajasi=son string d0 = Convert.ToString(m[0]); int e0 = Convert.ToInt32(d0); string d1 = Convert.ToString(m[1]); int e1 = Convert.ToInt32(d1); string d2 = Convert.ToString(m[2]); int e2 = Convert.ToInt32(d2); string d3 = Convert.ToString(m[3]); int e3 = Convert.ToInt32(d3); string d4 = Convert.ToString(m[4]); int e4 = Convert.ToInt32(d4); string d5 = Convert.ToString(m[5]); int e5 = Convert.ToInt32(d5); string d6 = Convert.ToString(m[6]); int e6 = Convert.ToInt32(d6); string d7 = Convert.ToString(m[7]); int e7 = Convert.ToInt32(d7); string d8 = Convert.ToString(m[8]); int e8 = Convert.ToInt32(d8); double son2 = 0.1 * (e8 + e7 * 10 + e6 * 100 + e5 * 1000 + e4 * 10000 + e3 * 100000 + e2 * 1000000 + e1 * 10000000 + e0 * 100000000); X = son * son2; Console.WriteLine(X); Console.ReadLine(); } } } Download 216.24 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling