bsc

Comprehensive codebase and cou...
Log | Files | Refs | README | LICENSE

luc032.c (912B)


      1 /*
      2  * Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 12 Dec 2025
      3  * Repo: https://github.com/notamitgamer/bsc
      4  * License: MIT
      5  */
      6 
      7 /* Write a program to recieve an integer and find its octal equivalent.
      8 (Hint : To obtain octal equivalent of an integer, Divide it continuously
      9 by 8 till dividend does not become zero, then write the remainders
     10 obtained in reverse derection.) */
     11 /* Let Us C, Chap- 5, Page - 87, Qn No.: B(e) */
     12 
     13 // using array
     14 
     15 #include <stdio.h>
     16 int main()
     17 {
     18     int octal[20], decimal, index = 0, temp, rem;
     19     printf("Enter the decimal number : ");
     20     scanf("%d", &decimal);
     21     temp = decimal;
     22     while (temp != 0)
     23     {
     24         rem = temp % 8;
     25         temp = temp / 8;
     26         octal[index] = rem;
     27         index++;
     28     }
     29     printf("\nDeciaml %d to octal : ", decimal);
     30     while ((index - 1) >= 0)
     31     {
     32         printf("%d", octal[index - 1]);
     33         index--;
     34     }
     35     return 0;
     36 }
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror