Desconozco lo que pasa en este algoritmo de división entre flotantes

Course Queries Syllabus Queries 3 years ago

1.53K 1 0 0 0

User submissions are the sole responsibility of contributors, with TuteeHUB disclaiming liability for accuracy, copyrights, or consequences of use; content is for informational purposes only and not professional advice.

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 3 years ago

El resultado esperado es 0.5f pero en este algoritmo lo que consigo es 0.0f. ¿Que hago mal?

public class AlgoritmoDeSequencia
{
    private nt">int n;
    public AlgoritmoDeSequencia()
    {
        this.n = n;
    }

    public void algoritmo()
    {
        n = 2;
        float primario = 1/n;
        System.out.prnt">intln(primario);
    }
}
0 views
0 shares

No matter what stage you're at in your education or career, TuteeHUB will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.

Similar Forum