Java

Calculate natural numbers that are divide by 7 & 8 using Java

Calculate natural numbers that are divide by 7 & 8 using Java
//NATURALS NUMBERS THAT ARE DIVISIBLE BY 7 & 8 

import java.io.*; 

class ssvnat 
{ 
public static void main(String arg[]) throws IOException 
{ 
int i,a,b,s=0,start,end; 
BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); 
System.out.println("\n\t\t*** NATURALS NUMBERS THAT ARE DIVISIBLE BY 7 & 8 *** \n"); 
System.out.print("Enter the number will be started : "); 
start=Integer.parseInt(br.readLine()); 
System.out.print("Enter the number to be end : "); 
end=Integer.parseInt(br.readLine()); 
for(i=start;i<=end;i++) 
{ 
a=i%7; 
b=i%8; 
if((a==0)&&(b==0)) 
{ 
System.out.print("\t" + i); 
s=s+i; 
} 
} 
System.out.print("\n\nThe Sum of Numbers that are divisible by 7 and 8 : " + s); 
System.out.println(); 
} 
}
Senthilvelan Sambamoorthy

Senthilvelan Sambamoorthy is working as a Professor in Department of Master of Computer Applications, Paavai Engineering College, Namakkal, Tamilnadu, India, He is Masters in Computers Applications. Having 18+ years of experience and his area of interest is Java, JSP, Servlet, J2EE, C#, PHP, Python ASP.NET, SQL Server and etc.