Son va raqamlar
Download 27.17 Kb.
|
Dasturlash I 2-mustaqil ish
- Bu sahifa navigatsiya:
- ( Nuqta va doira )
- (Tub bo’luvchilar).
1. ( Son va raqamlar ). Uch xonali sonning raqamlarini o’sish tartibida joylashtiring . #include int main() { int n, a, b, c, result; cout<<"Uch xonali son kiriting:";cin>>n; a = n % 10; n = n / 10; b = n % 10; n = n / 10; c = n % 10; cout<<"sonlar o'sish tartibida:"; if(a>b & a>c){ if(b>c){ cout< else cout<} else if(b>a & b>c){ if(a>c){ cout< else cout<} else if(c>b & c>a){ if(b>a){ cout<} else cout<} return 0; } 2. ( Nuqta va doira ) 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; float distance(int x1, int y1, int x2, int y2) { return sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2) * 1.0); } int main() { float m, R; int x1, y1, c, x2 = 0, y2 = 0; cout<<"Quyidagi tartibda kiriting: X1, y1, R:";cin>>x1>>y1>>R; if(distance(x1,y1,x2,y2) < R) cout<<"Nuqta doira ichida"< cout<<"Nuqta doiradan tashqarida"; else cout<<"Nuqta doira chegarasida"; return 0; } 3. (Tub bo’luvchilar). Berilgan natural sonning barcha tub bo‘luvchilari chop etilsin. #include #include using namespace std; float distance(int x1, int y1, int x2, int y2) { return sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2) * 1.0); } int main() { float m, R; int x1, y1, c, x2 = 0, y2 = 0; cout<<"Quyidagi tartibda kiriting: X1, y1, R:";cin>>x1>>y1>>R; if(distance(x1,y1,x2,y2) < R) cout<<"Nuqta doira ichida"< cout<<"Nuqta doiradan tashqarida"; else cout<<"Nuqta doira chegarasida"; return 0; } 4. 3 ta butun son berilgan bu sonlar arifmetik progressiyaning hadlari bo’la oladimi ? #include using namespace std; int main() { int a,b,c,m;cin>>a>>b>>c; m = b-a; m = b+m; if(c = m){ cout << "Ha"; } else{ cout << "yo'q"; } return 0; } 5. tezlanish bilan harakatini boshlagan jism t vaqtdan so’ng qancha masofani bosib o’tadi . #include using namespace std; int main() { int a,t; cin>>a>>t; cout<<((a*t*t)/2); return 0; } Download 27.17 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling