Insertion Sorting
int a[6] = {5, 1, 6, 2, 4, 3};
int i, j, key;
for(i=1; i<6; i++)
{
key = a[i];
j = i-1;
while(j>=0 && key < a[j])
{
a[j+1] = a[j];
j--;
}
a[j+1] = key;
}
Telegram | Viktorina bot | Portfolio
int a[6] = {5, 1, 6, 2, 4, 3};
int i, j, key;
for(i=1; i<6; i++)
{
key = a[i];
j = i-1;
while(j>=0 && key < a[j])
{
a[j+1] = a[j];
j--;
}
a[j+1] = key;
}
Telegram | Viktorina bot | Portfolio
Telegram
PROGRAMMERS
Guruh: @Cpp_java_dasturlash
Android: @prog_mz_android
Quiz bot: @programmersQuiz_bot
Portfolio: @ProgrammersPortfolio
Reklama: https://t.iss.one/programmers_reklama/2
Kanal uchun taklif:
@Mr_Max_Telegram
@ZohidAbdullayev
Android: @prog_mz_android
Quiz bot: @programmersQuiz_bot
Portfolio: @ProgrammersPortfolio
Reklama: https://t.iss.one/programmers_reklama/2
Kanal uchun taklif:
@Mr_Max_Telegram
@ZohidAbdullayev
π2β€1π€©1π―1
#javob_kotlin_boolean_27
fun main() {
print("x = ")
val x = readLine()!!.toInt()
print("y = ")
val y = readLine()!!.toInt()
println((x < 0 && y > 0) or (x < 0 && y < 0))
}
Telegram | Viktorina bot | Portfolio
fun main() {
print("x = ")
val x = readLine()!!.toInt()
print("y = ")
val y = readLine()!!.toInt()
println((x < 0 && y > 0) or (x < 0 && y < 0))
}
Telegram | Viktorina bot | Portfolio
π1π1π€©1
#javob_kotlin_boolean_28
fun main() {
print("x = ")
val x = readLine()!!.toInt()
print("y = ")
val y = readLine()!!.toInt()
println((x > 0 && y > 0) or (x < 0 && y < 0))
}
Telegram | Viktorina bot | Portfolio
fun main() {
print("x = ")
val x = readLine()!!.toInt()
print("y = ")
val y = readLine()!!.toInt()
println((x > 0 && y > 0) or (x < 0 && y < 0))
}
Telegram | Viktorina bot | Portfolio
π3π³2β€βπ₯1π₯1
Bubble Sorting
int a[6] = {5, 1, 6, 2, 4, 3};
int i, j, temp;
for(i=0; i<6, i++)
{
for(j=0; j<6-i-1; j++)
{
if( a[j] > a[j+1])
{
temp = a[j];
a[j] = a[j+1];
a[j+1] = temp;
}
}
}
Telegram | Viktorina bot | Portfolio
int a[6] = {5, 1, 6, 2, 4, 3};
int i, j, temp;
for(i=0; i<6, i++)
{
for(j=0; j<6-i-1; j++)
{
if( a[j] > a[j+1])
{
temp = a[j];
a[j] = a[j+1];
a[j+1] = temp;
}
}
}
Telegram | Viktorina bot | Portfolio
Telegram
PROGRAMMERS
Guruh: @Cpp_java_dasturlash
Android: @prog_mz_android
Quiz bot: @programmersQuiz_bot
Portfolio: @ProgrammersPortfolio
Reklama: https://t.iss.one/programmers_reklama/2
Kanal uchun taklif:
@Mr_Max_Telegram
@ZohidAbdullayev
Android: @prog_mz_android
Quiz bot: @programmersQuiz_bot
Portfolio: @ProgrammersPortfolio
Reklama: https://t.iss.one/programmers_reklama/2
Kanal uchun taklif:
@Mr_Max_Telegram
@ZohidAbdullayev
π1π₯°1π1π―1
#javob_kotlin_boolean_29
fun main() {
print("x = ")
val x = readLine()!!.toInt()
print("y = ")
val y = readLine()!!.toInt()
print("x1 = ")
val x1 = readLine()!!.toInt()
print("y1 = ")
val y1 = readLine()!!.toInt()
print("x2 = ")
val x2 = readLine()!!.toInt()
print("y2 = ")
val y2 = readLine()!!.toInt()
println(x in (x1 + 1) until x2 && y in (y2 + 1) until y1)
}
Telegram | Viktorina bot | Portfolio
fun main() {
print("x = ")
val x = readLine()!!.toInt()
print("y = ")
val y = readLine()!!.toInt()
print("x1 = ")
val x1 = readLine()!!.toInt()
print("y1 = ")
val y1 = readLine()!!.toInt()
print("x2 = ")
val x2 = readLine()!!.toInt()
print("y2 = ")
val y2 = readLine()!!.toInt()
println(x in (x1 + 1) until x2 && y in (y2 + 1) until y1)
}
Telegram | Viktorina bot | Portfolio
π1π1π1
#javob_kotlin_boolean_30
fun main() {
print("a = ")
val a = readLine()!!.toInt()
print("b = ")
val b = readLine()!!.toInt()
print("c = ")
val c = readLine()!!.toInt()
println(a == b && b == c)
}
Telegram | Viktorina bot | Portfolio
fun main() {
print("a = ")
val a = readLine()!!.toInt()
print("b = ")
val b = readLine()!!.toInt()
print("c = ")
val c = readLine()!!.toInt()
println(a == b && b == c)
}
Telegram | Viktorina bot | Portfolio
π1π1π1π€©1
Binar darax tuzing va uni maβlumot bilan toβldiring. Daraxt maβlumotlarini ekranga chiqaring.
Source code:
#include<iostream>
using namespace std;
struct daraxt
{
int info;
daraxt* Left = NULL;
daraxt* Right = NULL;
};
void Add(daraxt* &a,int x)
{
if(!a)
{
daraxt* t = new daraxt;
t->info = x;
a = t;
return;
}
if(a->info<x)
{
Add(a->Right,x);
}
else
{
Add(a->Left,x);
}
}
void Show(daraxt* &a)
{
if(a==NULL) return;
if(a->Left) Show(a->Left);
coutΒ«a->infoΒ«" ";
if(a->Right) Show(a->Right);
}
int main()
{
daraxt* a = NULL;
int x;
while(cinΒ»x)
{
Add(a,x);
}
coutΒ«"Daraxt: "Β«a->infoΒ«endl;
Show(a);
return 0;
}
Telegram | Viktorina bot | Portfolio
Source code:
#include<iostream>
using namespace std;
struct daraxt
{
int info;
daraxt* Left = NULL;
daraxt* Right = NULL;
};
void Add(daraxt* &a,int x)
{
if(!a)
{
daraxt* t = new daraxt;
t->info = x;
a = t;
return;
}
if(a->info<x)
{
Add(a->Right,x);
}
else
{
Add(a->Left,x);
}
}
void Show(daraxt* &a)
{
if(a==NULL) return;
if(a->Left) Show(a->Left);
coutΒ«a->infoΒ«" ";
if(a->Right) Show(a->Right);
}
int main()
{
daraxt* a = NULL;
int x;
while(cinΒ»x)
{
Add(a,x);
}
coutΒ«"Daraxt: "Β«a->infoΒ«endl;
Show(a);
return 0;
}
Telegram | Viktorina bot | Portfolio
Telegram
PROGRAMMERS
Guruh: @Cpp_java_dasturlash
Android: @prog_mz_android
Quiz bot: @programmersQuiz_bot
Portfolio: @ProgrammersPortfolio
Reklama: https://t.iss.one/programmers_reklama/2
Kanal uchun taklif:
@Mr_Max_Telegram
@ZohidAbdullayev
Android: @prog_mz_android
Quiz bot: @programmersQuiz_bot
Portfolio: @ProgrammersPortfolio
Reklama: https://t.iss.one/programmers_reklama/2
Kanal uchun taklif:
@Mr_Max_Telegram
@ZohidAbdullayev
π2β‘1β€1π1π1
#javob_kotlin_boolean_31
fun main() {
print("a = ")
val a = readLine()!!.toInt()
print("b = ")
val b = readLine()!!.toInt()
print("c = ")
val c = readLine()!!.toInt()
println((a == b && b != c) or (a == c && a != b) or (b == c && b != a))
}
Telegram | Viktorina bot | Portfolio
fun main() {
print("a = ")
val a = readLine()!!.toInt()
print("b = ")
val b = readLine()!!.toInt()
print("c = ")
val c = readLine()!!.toInt()
println((a == b && b != c) or (a == c && a != b) or (b == c && b != a))
}
Telegram | Viktorina bot | Portfolio
π1π―1
#javob_kotlin_boolean_32
fun main() {
print("a = ")
val a = readLine()!!.toInt()
print("b = ")
val b = readLine()!!.toInt()
print("c = ")
val c = readLine()!!.toInt()
println((a * a + b * b == c * c) or (a * a + c * c == b * b) or (b * b + c * c == a * a))
}
Telegram | Viktorina bot | Portfolio
fun main() {
print("a = ")
val a = readLine()!!.toInt()
print("b = ")
val b = readLine()!!.toInt()
print("c = ")
val c = readLine()!!.toInt()
println((a * a + b * b == c * c) or (a * a + c * c == b * b) or (b * b + c * c == a * a))
}
Telegram | Viktorina bot | Portfolio
π1π₯°1π―1π1
#include <iostream>
/// a va b sonlari uchun EKUB(a, b) ni toping.
using namespace std;
int EKUB(int a, int b)
{
while (a != b)
{
if (a > b)
{
a = a - b;
}
if (b > a)
{
b = b - a;
}
}
return a;
}
int main()
{
int a, b;
cout << "a = "; cin >> a;
cout << "b = "; cin >> b;
cout << "EKUB(a, b) = " << EKUB(a, b) << endl;
return 0;
}
Telegram | Viktorina bot | Portfolio
/// a va b sonlari uchun EKUB(a, b) ni toping.
using namespace std;
int EKUB(int a, int b)
{
while (a != b)
{
if (a > b)
{
a = a - b;
}
if (b > a)
{
b = b - a;
}
}
return a;
}
int main()
{
int a, b;
cout << "a = "; cin >> a;
cout << "b = "; cin >> b;
cout << "EKUB(a, b) = " << EKUB(a, b) << endl;
return 0;
}
Telegram | Viktorina bot | Portfolio
Telegram
PROGRAMMERS
Guruh: @Cpp_java_dasturlash
Android: @prog_mz_android
Quiz bot: @programmersQuiz_bot
Portfolio: @ProgrammersPortfolio
Reklama: https://t.iss.one/programmers_reklama/2
Kanal uchun taklif:
@Mr_Max_Telegram
@ZohidAbdullayev
Android: @prog_mz_android
Quiz bot: @programmersQuiz_bot
Portfolio: @ProgrammersPortfolio
Reklama: https://t.iss.one/programmers_reklama/2
Kanal uchun taklif:
@Mr_Max_Telegram
@ZohidAbdullayev
π1π1π1π1
#javob_kotlin_boolean_33
fun main() {
print("a = ")
val a = readLine()!!.toInt()
print("b = ")
val b = readLine()!!.toInt()
print("c = ")
val c = readLine()!!.toInt()
println((a + b > c) && (a + c > b) && (b + c > a))
}
Telegram | Viktorina bot | Portfolio
fun main() {
print("a = ")
val a = readLine()!!.toInt()
print("b = ")
val b = readLine()!!.toInt()
print("c = ")
val c = readLine()!!.toInt()
println((a + b > c) && (a + c > b) && (b + c > a))
}
Telegram | Viktorina bot | Portfolio
π1π₯1π―1
#javob_kotlin_boolean_34
fun main() {
print("x = ")
val x = readLine()!!.toInt()
print("y = ")
val y = readLine()!!.toInt()
println((x + y) % 2 == 1)
}
Telegram | Viktorina bot | Portfolio
fun main() {
print("x = ")
val x = readLine()!!.toInt()
print("y = ")
val y = readLine()!!.toInt()
println((x + y) % 2 == 1)
}
Telegram | Viktorina bot | Portfolio
β€1β‘1π1