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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:29:52+00:00 2026-06-12T14:29:52+00:00

public class TryMyMath { public static void main(String args[]) { double num = Math.E;

  • 0
public class TryMyMath {

    public static void main(String args[])
    {

        double num = Math.E;
        printTable(num);
    }// end main

    public static void printTable(double num){
        int n = 1;

        for(n = 1;n <= 10; n++)
        {
            num = Math.pow(num, n);
            System.out.printf("%d %lf", n, num);
        }
        round100th(num);

    }
    public static double round100th(double num)
    {
        return Math.round(num*100.)/100.0 ;
    } // end round100th

}

i have this question with using printf in java, so this is the error i get with printf

Exception in thread "main" java.util.UnknownFormatConversionException: Conversion = 'l'
  at java.util.Formatter$FormatSpecifier.conversion(Unknown Source)
  at java.util.Formatter$FormatSpecifier.<init>(Unknown Source)
  at java.util.Formatter.parse(Unknown Source)
  at java.util.Formatter.format(Unknown Source)
  at java.io.PrintStream.format(Unknown Source)
  at java.io.PrintStream.printf(Unknown Source)
  at TryMyMath.printTable(TryMyMath.java:15)
  at TryMyMath.main(TryMyMath.java:7)

when i take out printf statement there wasn’t any error, am I not using printf the right way it is supposed to be used in java?

and also i’m new to java and eclipse so i don’t know what those error mean.

so this is the out put that i get

1
2.7182822
7.3890563
403.4287934
26489122129.8434375
13041808783936237000000000000000000000000000000000000.0000006
Infinity7
Infinity8
Infinity9
Infinity10
Infinity

the output is only right up to n = 3 i don’t see anything wrong with the for loop why is this happen?

nvm i saw what wrong with it

  • 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-12T14:29:54+00:00Added an answer on June 12, 2026 at 2:29 pm

    It should be System.out.printf("%d %f", n, num). The l is meaningless here.

    Additionally, your round100th(num); call has no effect – are you trying to print the numbers to two decimal places? You can do that with:

    System.out.printf("%d %.2f", n, num)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public class Demo { public static void main(String args[]) { double d = 12.345;
public class Employee { public static void main(String[] args) { int j=3; staples[] stemp
public class Test { public static void main(String[] args) { DemoAbstractClass abstractClass = new
public class Test { public static void main(String[] args) { try { doSomething(new TestCallback()
public class InterruptedInput { public static void main(String[] args) { InputThread th=new InputThread(); //worker
public class Test { public static void main(String[] args) { } } class Outer
public class WrapperTest { public static void main(String[] args) { Integer i = 100;
public class readBin { public static void main(String[] args) throws IOException{ long time1 =
public class Db_try1 { public static void main(String[] args) { String driver=oracle.jdbc.OracleDriver; String url=jdbc:oracle:thin:@localhost:1521:xe;
public class Main { public static void main(String[] args) throws InterruptedException { ClassA a

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.