Focus mode

Backend Bootcamp Hazırlık Programı 4.Hafta

Pratik - Harmonik Sayıları Bulan Program

Harmonik Seri Bulan Program

Java ile girilen sayının harmonik serisini bulan program yazacağız.

Harmonik Seri Formülü :

public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("N sayısını giriniz :");
        double n = input.nextInt();
        double result = 0;
        while (n > 0) {
            result += (1 / n);
            n--;
        }

        System.out.println(result);
    }
}

left-disk

Programs to Accelerate Your Progress in a Software Career

Join our 4-8 month intensive Patika+ bootcamps, start with the fundamentals and gain comprehensive knowledge to kickstart your software career!

right-cube

Project

Comments

You need to enroll in the course to be able to comment!