Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need help editing code to make it look like expected output import java.util.*;

ID: 3590811 • Letter: N

Question

Need help editing code to make it look like expected output

import java.util.*;
import java.io.*;
import java.util.Scanner;
public class CountByAnything{
   public static void main(String args[]){
       Scanner in = new Scanner(System.in);
       System.out.println("Enter number");
       int n = in.nextInt();
       System.out.println("Counting by "+n+" up to "+n*100);
       int i=1;
       while(i<=100){
           System.out.print(n*i+" ");
           if(i%10==0)
               System.out.println();
           i++;
       }
   }
}

Latest submission - 12:46 PM on 10/12/17 Total score: 0 10 Only show failing tests Download this submission 1: Compare output 0/2 Input 9 Counting by 9 up to 900 9 18 27 36 45 54 63 72 81 90 99 108 117 126 135 144 153 162 171 180 189 198 207 216 225 234 243 252 261 270 279 288 297 306 315 324 333 342 351 360 Your output 369 378 387 396 405 414 423 432 441 450 459 468 477 486 495 504 513 522 531 540 549 558 567 576 585 594 603 612 621 630 639 648 657 666 675 684 693 702 711 720 729 738 747 756 765 774 783 792 801 810 19 828 837 846 855 864 873 882 891 900 Counting by 9 up to 900: 9 18 27 36 45 54 63 72 81 90 99 108 117 126 135 144 153 162 171 180 189 198 207 216 225 234 243 252 261 270 279 288 297 306 315 324 333 342 351 360 Expected output 369 378 387 396 405 414 423 432 441 450 459 468 477 486 495 504 513 522 531 540 549 558 567 576 585 594 603 612 621 630 639 648 657 666 675 684 693 702 711 720 729 738 747 756 765 774 783 792 801 810 819 828 837 846 855 864 873 882 891 900

Explanation / Answer

import java.util.*;
import java.io.*;
import java.util.Scanner;
public class CountByAnything{
public static void main(String args[]){
Scanner in = new Scanner(System.in);
System.out.println("Enter number");
int n = in.nextInt();
//added colon (:) and the end in print statement
System.out.println("Counting by "+n+" up to "+n*100+":");
int i=1;
while(i<=100){
System.out.print(n*i+" ");
if(i%10==0){
// last line println() should not be used.
if(i!=100){
System.out.println();
}
}
i++;
}
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote