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:
N soni satr uzunligidan kichik bo’lgan holda natija:
Do'stlaringiz bilan baham: |