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 4622882
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:54:23+00:00 2026-05-22T02:54:23+00:00

sorry if its a stupid question, but I a beginner using StreamTokenizer, I am

  • 0

sorry if its a stupid question, but I a beginner using StreamTokenizer, I am trying to solve this exercise this, please help me, I dont know what its wrong in my program that never reach my solve method, it also never finishes, I already ask in timus forum, but I know that here is faster to receive an answers

import java.io.*;

public class Prueba {
    static int index = 0;
    static double[] l = new double[131072];

    public static void main(String args[]) throws IOException {
        StreamTokenizer str = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        while (((str.nextToken() != StreamTokenizer.TT_EOF))) {
            if (str.ttype == StreamTokenizer.TT_NUMBER) {
                l[index++] = str.nval;
                //System.out.println(str.nval);
                // System.out.println(l[0]);
                // System.out.println(l[1]);
            }
        }
        solve();
    }

    public static void solve() {
        double res;
        for (int i = index - 1; i >= 0; i--) {
            res = Math.sqrt(l[i]);
            System.out.println(String.format("%.4f\n", res));
        }
    }
}
  • 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-05-22T02:54:24+00:00Added an answer on May 22, 2026 at 2:54 am

    You are reading from the standard input, and your code loops until it gets a TT_EOF. To feed a TT_EOF into your program, you need to press Ctrl-D if you’re using Unix, or Ctrl-Z followed by Enter if you’re using Windows.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello first sorry if its a stupid question, but I amm a beginner, and
im sorry if this is a stupid question but i was curious, i have
Sorry if this seems like a stupid question but im actually having a hard
Sorry if this seems like a stupid question but can't find any info on
sorry if this question is stupid, but I can't wrap my head around Java
Sorry if this is a stupid question, but I can't get this to work.
Sorry if this is a stupid question, but it's something that I'm curious about.
Sorry if its a stupid question. But I just wrote a tiny c# application
Really stupid question, sorry, but I can't find it on google (I'm sure it's
Sorry if this is a really basic question but it's been really getting to

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.