- Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathP65.java
55 lines (36 loc) · 1.05 KB
/
P65.java
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/**
* P65 : تعداد کل ارقام 100 عدد
*
* @author Gholamali Nejad Hajali Irani
* @version 1.0
* @since 2021/01/15
* @Team gClassAcademy
* @Website https://www.youtube.com/c/gClassAcademy
*/
importjava.util.Scanner;
publicclassP65
{
publicstaticvoidmain(String[] args)
{
Scannerinput=newScanner (System.in);
intn=0;// عددی که هر مرحله از کاربر دریافت میشود
intcountall=0;
for (intx=1;x<=100;x++)
{
// گرفتن n
System.out.println("Enter n: ");
n=input.nextInt();
// محاسبات روی n
// تعداد ارقام n
intcount=0; // برای محاسبه تعداد ارقام n
while (n>0)
{
//sum = sum + n%10; //جمع رقم یکان n روی sum
count++;
n=n/10; //حذف رقم یکان n
}
countall = countall+count;
}// end of for x
System.out.println("Count of All is:" + countall);
}// end of main
}// end of class