Abdullayev G’iyosiddin oraliqdan bajargan nazorat ish //Abdullayev G'iyosiddin


Download 1.23 Mb.
Sana11.05.2023
Hajmi1.23 Mb.
#1450014
Bog'liq
Abdullayev Giyosiddin


Abdullayev G’iyosiddin oraliqdan bajargan nazorat ish
//Abdullayev G'iyosiddin
//Algoritmlash va dasturlash fanidan 1-oraliq nazorat ishi.
//1-misol
import java.util.Scanner;
import java.math.*;
import java.util.Random;
public class Main {
public static void main(String[] args) {
Random soon= new Random();
int soonNum = soon.nextInt(35 - 1 + 1) + 1;
System.out.println(soonNum);
}
}
//2-misol

System.out.println("4-masala");
Scanner sc=new Scanner(System.in);
System.out.println("a ni kiriting=");
int a=sc.nextInt();
System.out.println("b ni kiriting=");
int b=sc.nextInt();
for (int i=a; i<=b; i++){
if(i%2==1){
System.out.println(i);
}else if (i%2==0) {
System.out.println(-1*i);
}
}
//3-misol
import java.util.Scanner;import static java.lang.Math.*;
import java.util.Random;public class Oraliq {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
System.out.println("a va b sonlartini kiriting");
int a=sc.nextInt();
int b=sc.nextInt();
for (int i=a;iSystem.out.println(i);
} }
}
//4-misol
import java.util.Scanner;

public class Main {


public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Nomanfiy sonni kiriting: ");
int son = input.nextInt();
if (son == 0)
{
System.out.println("Nol");
return;
}
String result = "";
if (son < 0)
{
result += "minus ";
son = -son;
}
String[] ones = {"", "bir", "ikki", "uch", "to'rt", "besh", "olti", "yetti", "sakkiz", "to'qqiz"};
String[] tens = {"", "", "yigirma", "o'ttiz", "qirq", "ellik", "oltmish", "yetmish", "sakson", "to'qson"};
String[] hundreds = {"", "bir yuz", "ikki yuz", "uch yuz", "to'rt yuz", "besh yuz", "olti yuz", "yetti yuz", "sakkiz yuz", "to'qqiz yuz"};
if (son >= 100) {
result += hundreds[son / 100] + " ";
son %= 100;
}
if (son >= 10 && son <= 99)
{
result += tens[son / 10] + " ";
son %= 10;
}
if (son >= 1 && son <= 9) {
result += ones[son];
}
System.out.println(result);
}
}

//5-misol
Download 1.23 Mb.

Do'stlaringiz bilan baham:




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