import java.io.*;
public class xupon258
{
public static void main(String args[]) throws IOException
{ InputStreamReader read = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(read);
System.out.println("Enter a number");
double x=Double.parseDouble(br.readLine());
System.out.println("Now x/2+x/5+x/8");
double sum=0;
for(int i=2;i<=8;i+=3)
{ sum+=x/i;
System.out.println("After adding "+x+"/"+i+", sum till now is "+sum);
}
System.out.println("Final Sum is " +sum);
}
}
Tuesday, March 23, 2010
x/2 + x/5 + x/8
Subscribe to:
Post Comments (Atom)
this could have been done without the sopln line
ReplyDelete