1.02K subscribers
1.77K photos
420 videos
676 files
3.84K links
Download Telegram
❀1πŸ‘1πŸ₯°1🐳1
πŸ‘2⚑1πŸ‘Œ1πŸ’―1
Selection sort
void selectionSort(int a[], int size)
{
int i, j, min, temp;
for(i=0; i < size-1; i++ )
{
min = i; //setting min as i
for(j=i+1; j < size; j++)
{
if(a[j] < a[min]) //if element at j is less than element at min position
{
min = j; //then set min as j
}
}
temp = a[i];
a[i] = a[min];
a[min] = temp;
}
}

Telegram | Viktorina bot | Portfolio
⚑1❀1πŸ‘1
#javob_kotlin_boolean_25

fun main() {
print("x = ")
val x = readLine()!!.toInt()
print("y = ")
val y = readLine()!!.toInt()
println(x < 0 && y > 0)
}

Telegram | Viktorina bot | Portfolio
πŸ‘1🐳1πŸ†1
#javob_kotlin_boolean_26

fun main() {
print("x = ")
val x = readLine()!!.toInt()
print("y = ")
val y = readLine()!!.toInt()
println(x > 0 && y < 0)
}

Telegram | Viktorina bot | Portfolio
πŸ‘1😍1🐳1πŸ’―1
πŸ‘1πŸ”₯1πŸ’―1
⚑1πŸ‘1πŸ₯°1
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
πŸ‘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
πŸ‘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
πŸ‘3🐳2❀‍πŸ”₯1πŸ”₯1
πŸ‘1😍1πŸ†1
⚑1πŸ”₯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
πŸ‘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
πŸ‘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
πŸ‘1πŸ‘1😁1🀩1
πŸ‘1πŸ”₯1πŸ₯°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
πŸ‘2⚑1❀1😁1πŸ‘Œ1
πŸ‘3😁2πŸ”₯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
πŸ‘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
πŸ‘1πŸ₯°1πŸ’―1πŸ†1