Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8042979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:45:51+00:00 2026-06-05T04:45:51+00:00

hi guys i am just doing some reading for myself to learn java and

  • 0

hi guys i am just doing some reading for myself to learn java and came across this problem and is currently stuck.

i need to print out series of number based on the input given by the user.
for example, if input = 5, the output should be as follows

@1@22@333@4444@55555

    import java.util.*;

public class ex5{
        public static void main(String[] args){
                Scanner kb = new Scanner(System.in);
                System.out.println("Please type a #: ");

                int input = kb.nextInt();

                for(int i=0;i<input;i++){
                        if(input==1){
                                System.out.print("@1");
                        }
                        if(input==2){
                                System.out.print("@1@22");
                        }
                }

        }
}

this doesnt seem to be working because this is the output i get

Please type a #:
2
@1@22@1@22

im not sure what to put inside the for loop right now and i dont think i am using the for loop here very well either…

any help guys?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T04:45:53+00:00Added an answer on June 5, 2026 at 4:45 am
        for (int i=1; i<=5; i++){
            System.out.print("@");
            for (int j=1; j<=i; j++) System.out.print(i);
        }
    

    out

    @1@22@333@4444@55555
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Guys, I've came across this problem I can't resolve myselg, I'm pretty sure I
Hey guys, It's 5 am here, I was doing some code... when this came
I am currently doing an mvc3 razor project and I need some charts. I
Hey guys. Just like in the title - I'm having some problems doing it.
Guys I know this question is silly but just to make sure: Having in
Ok guys, just starting out with partitioning some tables in mySQL. There's a couple
Hey guys, I'm working on a status-Updater. It works, there is just one problem,
Okay, before you guys go nuts -- this is just a small site, temporary
HI guys, I am new to rails and just doing my first registration form.
This question might seem very specific but I am in need of some ideas

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.