You Are Reading

0

Multiples of a Number

BufferedReader

Problem:
Write a program that will output the multiples of a number. Arrange it from lowest to highest.

Sample Output:


Source Codes:

package javaapplication1;

import java.io.*;
public class Multiple {

public static BufferedReader q= new BufferedReader(new InputStreamReader (System.in));
public static void main(String []args)throws IOException{

System.out.print("Enter a Number: ");
String a=q.readLine();
int b=Integer.parseInt(a);

for (int x=1; x int y;
y=b%x;
if (y==0)
{
System.out.println(x);
}
}
}

0 comments:

Post a Comment

 
Copyright 2010 BufferedReader