0% found this document useful (0 votes)
5 views21 pages

51 60 Flowgorithm

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views21 pages

51 60 Flowgorithm

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 21

Dastur kodi: Natija:

using System; Kiruvchi qiymat: Chiquvchi qiymat:


Input Output:
public class MyProgram
{
public static void Main(string[] args)
{
Console.WriteLine("1-sonni kiriting");
int a;

a = (int) inputValue();
Console.WriteLine("2-sonni kiriting");
int b;

b = (int) inputValue();
if (a > 21 && b > 21)
{
Console.WriteLine(0);
}
else
{
if (a <= 21 && b <= 21)
{
if (Math.Abs(21 - a) < Math.Abs(21 - b))
{
Console.WriteLine(a);
}
else
{
Console.WriteLine(b);
}
}
else
{
if (a <= 21)
{
Console.WriteLine(a);
}
else
{
Console.WriteLine(b);
}
}
}
}

// .NET can only read single characters or entire lines


from the
// console. The following function safely reads a double
value.
private static double inputValue()
{
double result;
while (!double.TryParse(Console.ReadLine(), out
result));
return result;
}
}

Dastur kodi: Natija:


using System; Kiruvchi qiymat: Chiquvchi qiymat:

public class MyProgram


{ Input Output:
public static void Main(string[] args) 2000 20-asr
{
Console.WriteLine("Yilni kiriting"); 1901 20-asr
int yil;

yil = (int) inputValue();


int asr;

if (yil % 100 == 0)
{
asr = (int) ((double) yil / 100);
}
else
{
asr = (int) ((double) yil / 100 + 1);
}
Console.WriteLine(asr.ToString() + "-asr");
}

// .NET can only read single characters or entire lines from the
// console. The following function safely reads a double value.
private static double inputValue()
{
double result;
while (!double.TryParse(Console.ReadLine(), out result));
return result;
}
}
Dastur kodi: Natija:

using System; Kiruvchi qiymat: Chiquvchi


qiymat:
public class MyProgram
{ Input Output:
public static void Main(string[] args)
{
Console.WriteLine("1-sonni kiriting");
int a;

a = (int) inputValue();
Console.WriteLine("2-sonni kiriting");
int b;

b = (int) inputValue();
Console.WriteLine("3-sonni kiriting");
int c;

c = (int) inputValue();
if (a + b == c || a + c == b || b + c == a)
{
Console.WriteLine(true);
}
else
{
Console.WriteLine(false);
}
}

// .NET can only read single characters or entire lines


from the
// console. The following function safely reads a double
value.
private static double inputValue()
{
double result;
while (!double.TryParse(Console.ReadLine(), out
result));
return result;
}
}
Dastur kodi: Natija:

using System; Kiruvchi qiymat: Chiquvchi qiymat:


Input Output:
public class MyProgram
{
public static void Main(string[] args)
{
Console.WriteLine("1-sonni kiriting");
int a;

a = (int) inputValue();
Console.WriteLine("2-sonni kiriting");
int b;

b = (int) inputValue();
Console.WriteLine("3-sonni kiriting");
int c;

c = (int) inputValue();
if (a + b >= a + c && a + b >= b + c)
{
Console.WriteLine("Eng katta yig'indiga ega sonlar: " + a +
" va " + b);
}
else
{
if (a + c >= a + b && a + c >= b + c)
{
Console.WriteLine("Eng katta yig'indiga ega sonlar: " + a
+ " va " + c);
}
else
{
Console.WriteLine("Eng katta yig'indiga ega sonlar: " + b
+ " va " + c);
}
}
}

// .NET can only read single characters or entire lines from the
// console. The following function safely reads a double value.
private static double inputValue()
{
double result;
while (!double.TryParse(Console.ReadLine(), out result));
return result;
}
}
Dastur kodi: Natija:

using System; Kiruvchi qiymat: Chiquvchi qiymat:


Input Output:
public class MyProgram
{ A=3 B=9 true
public static void Main(string[] args)
{
Console.WriteLine("1-sonni kiriting");
int a;

a = (int) inputValue();
Console.WriteLine("2-sonni kiriting");
int b;

b = (int) inputValue();
if (a == Math.Pow(b, 2) || b == Math.Pow(a, 2))
{
Console.WriteLine(true);
}
else
{
Console.WriteLine(false);
}
}

// .NET can only read single characters or entire lines from the
// console. The following function safely reads a double value.
private static double inputValue()
{
double result;
while (!double.TryParse(Console.ReadLine(), out result));
return result;
}
}
Dastur kodi: Natija:

using System; Kiruvchi qiymat: Chiquvchi qiymat:


Input Output:
public class MyProgram
{ 51342 Toq musbat
public static void Main(string[] args) sonlarning
{ yig'indisi: 9
int sum, number, i;

sum = 0;
for (i = 1; i <= 5; i++)
{
number = (int) inputValue();
if (number > 0 && number % 2 == 1)
{
sum = sum + number;
}
}
Console.WriteLine("Toq musbat sonlarning yig'indisi: " + sum);
}

// .NET can only read single characters or entire lines from the
// console. The following function safely reads a double value.
private static double inputValue()
{
double result;
while (!double.TryParse(Console.ReadLine(), out result));
return result;
}
}
Dastur kodi: Natija:

using System; Kiruvchi qiymat: Chiquvchi qiymat:


Input Output:
public class MyProgram
{ 2 4 6 4 8 12
public static void Main(string[] args)
{
Console.WriteLine("A-sonni kirit: ");
int a;

a = (int) inputValue();
Console.WriteLine("B-sonni kirit: ");
int b;

b = (int) inputValue();
Console.WriteLine("C-sonni kirit: ");
int c;

c = (int) inputValue();
if (a < b && b < c || a > b && b > c)
{
a = a * 2;
b = b * 2;
c = b * 2;
}
else
{
a = (int) (-a);
b = (int) (-b);
c = (int) (-c);
}
Console.WriteLine("A = " + a);
Console.WriteLine("B = " + b);
Console.WriteLine("C = " + c);
}

// .NET can only read single characters or entire lines from the
// console. The following function safely reads a double value.
private static double inputValue()
{
double result;
while (!double.TryParse(Console.ReadLine(), out result));
return result;
}
}
Dastur kodi: Natija:
using System; Kiruvchi qiymat: Chiquvchi
qiymat:
public class MyProgram
{
public static void Main(string[] args)
{
Console.WriteLine("Sonni kiriting");
int a;
Input Output:
a = (int) inputValue();
if (a > 0) 5 6
{
Console.WriteLine(a + 1); -1 -3
}
0 10
else
{
if (a < 0)
{
Console.WriteLine(a - 2);
}
else
{
Console.WriteLine(a + 10);
}
}
}

// .NET can only read single characters or entire lines from the
// console. The following function safely reads a double value.
private static double inputValue()
{
double result;
while (!double.TryParse(Console.ReadLine(), out result));
return result;
}
}
Dastur kodi: Natija:

using System; Kiruvchi qiymat: Chiquvchi qiymat:


Input Output:
public class MyProgram
{ 2 -1 3 Musbat sonlar soni:
public static void Main(string[] args) 2 ta
{
Console.WriteLine("A-sonni kirit: ");
int a;

a = (int) inputValue();
Console.WriteLine("B-sonni kirit: ");
int b;

b = (int) inputValue();
Console.WriteLine("C-sonni kirit: ");
int c;

c = (int) inputValue();
int sum;

sum = 0;
if (a > 0)
{
sum = sum + 1;
}
if (b > 0)
{
sum = sum + 1;
}
if (c > 0)
{
sum = sum + 1;
}
Console.WriteLine("Musbat sonlar soni: " + sum + " ta");
}

// .NET can only read single characters or entire lines from the
// console. The following function safely reads a double value.
private static double inputValue()
{
double result;
while (!double.TryParse(Console.ReadLine(), out result));
return result;
}
}
Dastur kodi: Natija:

using System; Kiruvchi qiymat: Chiquvchi qiymat:


Input Output:
public class MyProgram
{ 7 2 72
public static void Main(string[] args)
{
Console.WriteLine("A-sonni kirit: ");
int a;

a = (int) inputValue();
Console.WriteLine("B-sonni kirit: ");
int b;

b = (int) inputValue();
if (a > b)
{
Console.WriteLine(a.ToString() + "; " + b);
}
if (b > a)
{
Console.WriteLine(b.ToString() + "; " + a);
}
}

// .NET can only read single characters or entire lines from the
// console. The following function safely reads a double value.
private static double inputValue()
{
double result;
while (!double.TryParse(Console.ReadLine(), out result));
return result;
}
}

You might also like