-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwhile19.java
More file actions
27 lines (23 loc) · 590 Bytes
/
while19.java
File metadata and controls
27 lines (23 loc) · 590 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package whileGita;
import java.util.Scanner;
public class while19 {
public static void main(String[] args) {
int n;
Scanner scanner=new Scanner(System.in);
System.out.print("N:");
n = scanner.nextInt();
int sum = 0;
int num = 0;
while (n > 0)
{
++num;
sum += n % 10;
n /= 10;
}
System.out.print("Raqamlar soni:");
System.out.print(num);
System.out.print("\n");
System.out.print("Raqamlar yig`indisi:");
System.out.print(sum);
}
}