Advertisement
bagerzoltan

99-től 1-ig számok billentyűzet

Dec 5th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.74 KB | None | 0 0
  1. import java.io.*;
  2. public class feladat16 {
  3.     public static void main(String[]args) throws IOException, Exception{
  4.         int bekeres;
  5.         int szamok[];
  6.         File fajl=new File("E:\\16javamegoldas.txt");
  7.         FileWriter Kimeneti_stream = new FileWriter(fajl);
  8.         PrintWriter Kimeneti = new PrintWriter(Kimeneti_stream);
  9.         System.out.println("Hánytól írja ki a 3-mal osztható számokat 0-ig? ");
  10.         StreamTokenizer tokenek = new StreamTokenizer(new InputStreamReader(System.in));
  11.         tokenek.nextToken();
  12.         bekeres=(int)tokenek.nval;
  13.         szamok= new int[bekeres];
  14.         for (int i=bekeres; i>=3; i--) {
  15.             if (i % 3 == 0) {
  16.             Kimeneti.println(i);
  17.             System.out.print(i+", ");
  18.             }
  19.          }
  20.         Kimeneti.close();
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement