Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
Euler's Totient function for all numbers smaller than or equal to n in java
Following is a program to get the result of Euler’s Totient function for all numbers smaller than or equal to n when n is given.
Program
import java.util.Scanner;
public class EulerTotient {
public static int gcd(int a,int b){
int i, hcf = 0;
for(i = 1; i Output
Enter the n value
10
1
1
1
2
2
2
2
3
3
4
Advertisements
