650-22 guruh talabasi
F.I.O: Temiraliev Mujibali Juraalizoda
Masala sharti:
N ta elementdan tashkil topgan massiv berilgan. Massiv oxirgi elementidan kichkina bo’lgan birinchi elementni chiqaruvchi dastur tuzing.
Dastur kodi:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner k = new Scanner(System.in) ;
System.out.println("n sonini kiriting: ");
int n = k.nextInt();
System.out.println("Massiv elementlarini kiriting: ");
int mas[] = new int[n];
for( int i=0; imas[i] = k.nextInt();
}
for( int i=0; iif (mas[n-1]>mas[i]){
System.out.println("oxirgi elementdan kichik bolgan birinchi son: " + mas[i]);
break;
}
else {
System.out.println("kiritilgan son exirgi elementdan katta yoki teng!");
}}
}}
Dastur natijasi:
Do'stlaringiz bilan baham: |