Ki22-01 guruhi talabasi Rustamov Sherbek (Matematika)


Download 12.53 Kb.
Sana13.12.2022
Hajmi12.53 Kb.
#1000517
Bog'liq
Rustamov Sherbek


KI22-01 guruhi talabasi Rustamov Sherbek


  1. (Matematika). Rux simining 5 m uzunligidagi bo’lagi 430 g massaga ega. Xonadonga simni o’tkazish uchun C m kerak. Bu maqsad uchun M g massali sim o’rami yetadimi?

#include


using namespace std;


int main()


{
int C, M;
cout << " sim uzunligini kiriting C = "; cin >> C;
cout << " shu sim massasi M = "; cin >> M;
int x = 430/5;

if( x * C <= M )


cout << "yetarli" << endl;

else
cout << " yetarli emas " << endl;


return 0;


}

2. ( Son va raqamlar ). Uch xonali sonning raqamlarini o’sish tartibida joylashtiring .


#include


#include
#include

using namespace std;


int main(){


int n;
cout << " n = "; cin >> n;
vector a;
while (n)
{
a.push_back(n % 10);
n /= 10;
}
sort(a.begin(), a.end());
for(int i = 0; i < a.size(); i++){
cout << a[i];
}

return 0;


}
3. X uzunlikdagi simdan nechta m uzunlikdagi sim kesib olish mumkinligini va qoldiqni chiqaring . X va M haqiqiy sonlar.

#include


using namespace std;
int main(){
double X,M,m;
cout << " X = "; cin >> X;
cout << " M = "; cin >> M;
int n;
n = X / M;
m = X - n * M;
cout << n << " ta butun " << endl;
cout << m << " qoldiq ";
return 0;
}

4. N nuqtaning koordinatalari(x,y) va doira radiusi(R) kiritadi. Bunda doiraning markazi koordinata o’qining boshida yotadi. Nuqta doiraning ichida yotadimi.


#include
#include
using namespace std;

int main()


{
double x, y, r, m;

cout << " x = "; cin >> x;


cout << " y = "; cin >> y;
cout << " r = "; cin >> r;

m = sqrt(x * x + y * y);


if(m < r){
cout << " nuqta doiradan tashqarida ";
}
else if(m==r){
cout << " nuqta doira chegarasida ";
}
else if(m >r){
cout << " nuqta doira ichida ";

}
cout << " joylashgan " << endl;

return 0;
}

5. Berilgan natural sonning barcha tub bo‘luvchilari chop etilsin.


#include
#include
#include
using namespace std;
char tub (int n) {
int i,m,a;
float b;int x=0; int y=1;
m = sqrt (n) + 1;
for (i=2; ib=n% i;
if (b== 0) {
return x;
}}
return y;}
int main () {
int n;
cout<< "n="; cin>>n;
for (int i=2; i<= n; i++)
if (tub(i)==1)
cout <return 0;
}

6. 3 ta butun son berilgan bu sonlar arifmetik progressiyaning hadlari bo’la oladimi ?


#include
#include
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int arr[3];
arr[0] = a;
arr[1] = b;
arr[2] = c;
bool m = false;
int n = sizeof(arr) / sizeof(arr[0]);
sort(arr, arr + n);
int d = arr[1] - arr[0];
for (int i=0; i<2; i++){
if (arr[i]+d != arr[i+1]){
m = true;
}
}
if (m == true){
cout << " yo'q ";
}
else {
cout << " ha ";
}

return 0;


}

7. Berilgan a va b sonlarining EKUB ini chop qiluvchi dastur tuzing


#include
using namespace std;
int main() {
int a, b;
cout << " a = "; cin >> a;
cout << " b = "; cin >> b;

while (a != b){


if (a > b){
a = a - b;
}
else if(a < b){
b = b - a;
}
}
cout << a;

return 0;


}

8. O‘nlik sanoq sistemasida berilgan son sakkizlik sanoq sistemasiga o‘tkazilsin.


#include

using namespace std;


int main()
{
int x;
cout << " Sonni kiriting: ";
cin >> x;
cout << " Natija : ";
if (x % 8 == 0)
cout << 10;
else if (x / 8 >= 1)
cout << (x / 8) * 10 + x % 8;
else
cout << x;
return 0;
}

9. a tezlanish bilan harakatini boshlagan jism t vaqtdan so’ng qancha masofani bosib o’tadi


#include

using namespace std;


int main() {
int a, t, S;
cout << " a = "; cin >> a;
cout << " t = "; cin >> t;
S = (a * t * t) / 2;
cout << " S = " << S << endl;
return 0;
}

10. Haqiqiy turdagi 2 ta sonlar juftligi berilgan: x1,y1 va x2,y2. Har bir sonlar juftini tekislikdagi nuqta koordinatalari deb qarab, berilgan nuqtalar orasidagi masofa chop etilsin.

#include
#include
using namespace std;

int main()


{
int x1, x2, y1, y2, D;

cout << " x1 = "; cin >> x1;


cout << " x2 = "; cin >> x2;
cout << " y1 = "; cin >> y1;
cout << " y2 = "; cin >> y2;

D = sqrt( pow((x1-x2),2) + pow((y1-y2),2));



cout << " D = " << D << endl;
return 0;
}

Download 12.53 Kb.

Do'stlaringiz bilan baham:




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