public class Divisible {
int num;
int sum;
public void calculate() {
sum=0;
System.out.println("Numbers divisible by 9:");
for(num=50;num<100;num++) {
if(num%9==0) {
System.out.println(num);
sum=sum+num;
}
}
System.out.println("Sum: "+sum);
}
public static void main(String a[]) {
Divisible obj=new Divisible();
obj.calculate();
}
}
for( int i = 54; i <= 100; i += 9 ) {
System.out.println(i);
}
}
public class TestMain {
/**
* @param args
*/
public static final void main(String[] args) {
int sum = 0;
int count = 0;
for (int i = 100; i <= 200; i++){
if(i%7 == 0){
count++;
sum = sum + i;
System.out.println("The number is: " + i);
}
}
System.out.println("Number of values divisible by 7 between 100 and 200 is: " + count);
System.out.println("Sum of values divisible by 7 between 100 and 200 is: " + sum);
}
}
Output:
The number is: 105
The number is: 112
The number is: 119
The number is: 126
The number is: 133
The number is: 140
The number is: 147
The number is: 154
The number is: 161
The number is: 168
The number is: 175
The number is: 182
The number is: 189
The number is: 196
Number of values divisible by 7 between 100 and 200 is: 14
Sum of values divisible by 7 between 100 and 200 is: 2107
Convert the number to a string then test the string to see if the character '9' is present. If so, convert back to a number and print it.
Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.
#include
To print lucky numbers in java, you must give the following program: class example { static public void main(String[] args) { System.out.println("Lucky number is your favourite number which is your DOB"); } }
Reference:http:cprogramming-bd.com/c_page2.aspx# strange number
Cls input "enter two no.s ",a,b sum=a+b print "sum = ";sum end
Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.
Prime numbers are numbers that are only divisible by themselves and the number 1. You can write a program to print all prime numbers from 1 to 100 in FoxPro.
You can use int i; for (i = 10; i <= 50; i += 2) {//print i} as a program to print even numbers between 10 and 50.
#include
To print lucky numbers in java, you must give the following program: class example { static public void main(String[] args) { System.out.println("Lucky number is your favourite number which is your DOB"); } }
Reference:http:cprogramming-bd.com/c_page2.aspx# strange number
question clarity
Cls input "enter two no.s ",a,b sum=a+b print "sum = ";sum end
you do this 10 print "0112358132134" use the whole of the thing
write a program to print A to Z on screen in c?
Try the triangle program on a search engine. Replace numbers with stars and that should do the trick
Write a c program to print the 100 to 1 nos