O’ZBEKISTON RESPUBLIKASI OLIY VA O’RTA
MAXSUS TA’LIM VAZIRLIGI “MIRZO ULUG’BEK”
NOMIDAGI
O’ZBEKISTON MILLIY UNIVERSITETI
“AMALIY MATEMATIKA VA INTELLEKTUAL
TEXNOLOGIYALAR” FAKULTETI
“AXBOROT TIZIMLARI VA TEXNOLOGIYALARI”
YO’NALISHI
1-KURS “2101” GURUH TALABASI
ABDUXASIMOV ABBOSBEKNING
“ALGORITMIK TILLAR VA DASTURLASH”
FANIDAN TAYYORLAGAN
AMALIY
TOPSHIRIQLARI
Amaliy topshiriqlar
Quyidagi ifodalar o‘zgaruvchilarning berilgan qiymatlari uchun hisoblansin:
|
Berilganlar: x=-15.246,y=4.642x10-2, z=20.001x102,
.
Natija: =-182.036
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication9
{
class Program
{
static void Main(string[] args)
{
double x, y, z,a;
x = -15.246;
y = 4.642 * Math.Pow(10, -2);
z=20.001*Math.Pow(10,2);
a=Math.Log(Math.Pow(y,-Math.Sqrt(Math.Abs(x))), Math.E)*(x-(y/2))+Math.Pow(Math.Sin(Math.Atan(z)),2);
Console.Write(a);
Console.ReadKey();
}
}
}
2-amaliy topshiriq
5.Uchburchak uchlarining koordinatalari asosida uning yuzasi va perimetri topilsin.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication10
{
class Program
{
static void Main(string[] args)
{
double ax,ay, bx,by, cx,cy;
//nuqta va kordinatalarni qabul qilish
Console.Write("a nuqtaning x kordinatasini kiriting=> ");
ax = Convert.ToDouble(Console.ReadLine());
Console.Write("a nuqtaning y kordinatasini kiriting=> ");
ay = Convert.ToDouble(Console.ReadLine());
Console.Write("b nuqtaning x kordinatasini kiriting=> ");
bx = Convert.ToDouble(Console.ReadLine());
Console.Write("b nuqtaning y kordinatasini kiriting=> ");
by = Convert.ToDouble(Console.ReadLine());
Console.Write("c nuqtaning x kordinatasini kiriting=> ");
cx = Convert.ToDouble(Console.ReadLine());
Console.Write("c nuqtaning y kordinatasini kiriting=> ");
cy = Convert.ToDouble(Console.ReadLine());
double ab, bc, ac;
//tomonlar uzunligini aniqlash
//ikki nuqta orasidagi masofani aniqlash formulasi yordamida
ab = Math.Sqrt(Math.Pow((ax - bx), 2) + Math.Pow((ay - by), 2));
bc = Math.Sqrt(Math.Pow((bx - cx), 2) + Math.Pow((by - cy), 2));
ac = Math.Sqrt(Math.Pow((ax - cx), 2) + Math.Pow((ay - cy), 2));
//perimetrni hisoblash
double p = ab + bc + ac;
//yarim perimetrni hisoblash
double yp = p / 2;
//Geron formulasi yordamida uchburchakning yuzini hisoblash
double S = Math.Sqrt(yp * (yp - ab) * (yp - bc) * (yp - ac));
Console.WriteLine();
Console.WriteLine("Uchburchakning perimetri =>" + p);
Console.WriteLine("Uchburchakning yuzi =>" + S);
Console.ReadKey();
}
}
}
3-amaliy topshiriq
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication11
{
class Program
{
static void Main(string[] args)
{
double x, y=0;
Console.WriteLine("x ga qiymat bering=> ");
x=Convert.ToDouble(Console.ReadLine());
if (x <= -1)
{
y = -1 / Math.Pow(x, 2);
}
else if (x > -1 & x <= 2)
{
y = Math.Pow(x, 2);
}
else if (x > 2)
{
y = 4;
}
Console.WriteLine("y =" + y);
Console.ReadKey();
}
}
}
4-amaliy topshiriq
5.
|
Uchta x, y va z haqiqiy sonlar berilgan, agar ular monoton bo‘lsa ularning qiymatlari ikkilantirilsin, aks holda har bir o‘zgaruvchining ishorasi qarama-qarshisiga almashtirilsin.
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication12
{
class Program
{
static void Main(string[] args)
{
double x, y, z;
Console.WriteLine("x ga qiymat bering=> ");
x=Convert.ToDouble(Console.ReadLine());
Console.WriteLine("y ga qiymat bering=> ");
y = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("z ga qiymat bering=> ");
z = Convert.ToDouble(Console.ReadLine());
if ((x > y & y > z) || (x == y & y == z) || (x < y & y < z))
{
x = 2 * x;
y = 2 * y;
z = 2 * z;
}
else
{
x = -1 * x;
y = -1 * y;
z = -1 * z;
}
Console.WriteLine("x=" + x);
Console.WriteLine("y=" + y);
Console.WriteLine("z=" + z);
Console.ReadKey();
}
}
}
Do'stlaringiz bilan baham: |