Pythonda funktsiyani qanday chaqirish mumkin? Maksim Maksim


Download 65.28 Kb.
bet8/8
Sana22.12.2022
Hajmi65.28 Kb.
#1041656
1   2   3   4   5   6   7   8
Bog'liq
Abduxoliqov U.dock

for(int i=0;i<10;i++){
file.WriteLine(a + i*d);
}
file.Close();
Console.Write("Press any key to continue . . . ");
Console.ReadKey(true);
}
}
}

3-topshiriq.


Formaga 3 ta TextBox va bitta Button elementlarini joylang.textBox1 va textBox2 ga ixtiyoriy haqiqiy sonlar kiritilib ,Button1 tugmasi bosilganda textBox3 ga kiritilgan haqiqiy sonlarning kvadratlari yig’indisi agar haqiqiy sonlardan birortasi xato kiritilsa “Son xató kiritildi ”yozuvi chiqadigan dastur tuzing.
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;

namespace topshiriq_3
{
/// <summary>
/// Description of MainForm.
/// </summary>
public partial class MainForm : Form
{
public MainForm()
{

InitializeComponent();

label1.Text="1-son";
label2.Text="2-son";
label3.Text="natija";
button1.Width=150;
button1.Height=30;
button1.Text="natijani olish uchun bosing";
}

void Button1Click(object sender, EventArgs e)



try{
double x=Convert.ToDouble(textBox1.Text);
double y=Convert.ToDouble(textBox2.Text);
textBox3.Text=Convert.ToString(x*x+y*y);}
catch

textBox3.Text="Sonni xato kiritdingiz";
}
}


}





Download 65.28 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling