Va kommunikatsiyalarini rivojlantirish vazirligi muhammad al-xorazmiy nomidagi


Download 0.8 Mb.
bet4/5
Sana03.06.2020
Hajmi0.8 Mb.
#114033
1   2   3   4   5
Bog'liq
labo-7 java


Dastur Java kodi:

package algoritnm5labaratoriya;

import java.util.Scanner;

public class Algoritnm5labaratoriya {

public static void main(String[] args) {

Scanner kirit=new Scanner(System.in);

int s,n,m=0;

String soz;

System.out.println("sozni kiriting");

soz=kirit.nextLine();

System.out.println("sonni kiriting");

s=kirit.nextInt();

n=soz.length();

System.out.println(n);

StringBuffer ds=new StringBuffer();

ds.append(soz);

if(n>s){

System.out.println(ds.delete(0,n-s));

}

if(n


String ss="";

String sss="";

for(int i=0;i

ss+=".";}

sss=soz.concat(ss);

System.out.println(sss); } }}



Olingan natijalar:

Bunda ikkala holat ham tekshirilgan:

  1. N soni satr uzunligidan kichik bo’lgan holda natija:



Download 0.8 Mb.

Do'stlaringiz bilan baham:
1   2   3   4   5




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