package ifelse;
public class Thenaliraman {
public static void main(String[] args) {
int whip_bit=1024;
int count=0;
while(whip_bit>1) {
whip_bit=whip_bit/2;
count++;
System.out.println( whip_bit);
}
System.out.println("total person:" + count);
}
}
//output:
512
256
128
64
32
16
8
4
2
1
total person:10
package ifelse;
public class Number {
public static void main(String[] args) {
int a = 3;
int count = 1;
while (count <= 10) {
int b =count * a;
System.out.println(count + " * " + a + " = " +b);
count=count+1;
}
}
}
output:
1 * 3 = 3
2 * 3 = 6
3 * 3 = 9
4 * 3 = 12
5 * 3 = 15
6 * 3 = 18
7 * 3 = 21
8 * 3 = 24
9 * 3 = 27
10 * 3 = 30
package ifelse;
public class Number1 {
public static void main(String[] args) {
int a=100;
int b=120;
int count=1;
while(count<=a && count<=b) {
if(a%count==0 && b%count==0) {
System.out.println("common divisible numbers:"+ count);
}
count++;
}
}
}
output:
common divisible numbers:1
common divisible numbers:2
common divisible numbers:4
common divisible numbers:5
common divisible numbers:10
common divisible numbers:20
Top comments (0)
Subscribe
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)