import java.io.*;
import java.util.*;
public class str {
public static void main(String [] args) throws IOException{
String s;
int k,l,j=0;
Scanner sc=new Scanner(System.in);
System.out.print("satrni kirit..s=");
s=sc.nextLine();
Scanner sc1=new Scanner(s);
while (sc1.hasNext()){
l=sc1.nextInt();
j=j+l;
}
System.out.println("bu sonlar yig;indisi "+j+" ga teng");
}
}
Satrlar oqimi bilan ishlaganda biror satrda ixtiyoriy miqdorda so’zlar kiritilgan bo’lsa bu satrda nechta so’z borligini aniqlab beradi
import java.io.*;
import java.util.*;
public class leo {
public static void main(String [] args) throws IOException{
String s,s1;
int k=0,l,j=0,i=0;
Scanner sc=new Scanner(System.in);
System.out.print("satrni kirit..s=");
s=sc.nextLine(); i++;
Scanner sc1=new Scanner(s);
k=0;
while (sc1.hasNext()){
s1=sc1.next();
k++;
}
System.out.println("satrda " +k+ " ta so'z bor ");
Do'stlaringiz bilan baham: |