C Program
/* C - Decimal to Octal (short & working) */
#include <stdio.h>
int main() {
int n; scanf("%d", &n);
printf("%o\n", n);
return 0;
}C Output
Input:
83Output:
123
C++ Program
// C++ - Decimal to Octal (short & working)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n; cin >> n;
cout << oct << n << '\n';
}C++ Output
Input:
65Output:
101
JAVA Program
// Java - Decimal to Octal (short & working)
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
System.out.println(Integer.toOctalString(n));
}
}JAVA Output
Input: 50
Output:
62
Python Program
# Python - Decimal to Octal (short & working) n = int(input()) print(oct(n)[2:])
Python Output
Input:
100Output:
144
In-Depth Learning – Entire Concept in Paragraphs

Social Plugin