JAVA Model Questions || BIM STUDY NOTES
Model Questions Write a Java program to display all the numbers between -300 to -1 which when divided by 17 gives 7 as remainder and also displays sum of those numbers.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
public class Sum { public static void main(String[] args) { int i,s=0; for(i=-300;i<-1;i++) { if(i%17==-7){ System.out.print(i+ " "); s = s+i; } } System.out.println("The sum = "+s); } } |
3.Make two threads, one displays odd number after one second and another thread display even number after half second between -200 and -10. […]
Continue Reading