A PHP Error was encountered

Severity: Warning

Message: fopen(/var/cpanel/php/sessions/ea-php56/PHPSESSID5o2n0udcbfo4rvm5r6fbllj6b4q95n9v): failed to open stream: No space left on device

Filename: drivers/Session_files_driver.php

Line Number: 174

A PHP Error was encountered

Severity: Warning

Message: session_start(): Cannot send session cookie - headers already sent by (output started at /home/nerd/public_html/system/core/Exceptions.php:271)

Filename: Session/Session.php

Line Number: 144

A PHP Error was encountered

Severity: Warning

Message: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/nerd/public_html/system/core/Exceptions.php:271)

Filename: Session/Session.php

Line Number: 144

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home/nerd/public_html/system/core/Exceptions.php:271)

Filename: controllers/Questions.php

Line Number: 268

C program to convert number from Decimal to Octal
Q:

C program to convert number from Decimal to Octal

0

C program to convert number from Decimal to Octal

All Answers

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home/nerd/public_html/system/core/Exceptions.php:271)

Filename: questions/question_for_visitors.php

Line Number: 568

need an explanation for this answer? contact us directly to get an explanation for this answer

Decimal to Octal Conversion using C program

/*C program to convert number from decimal to octal*/

#include <stdio.h>

int main()
{
    int number, cnt, i;
    int oct[32];

    printf("Enter decimal number: ");
    scanf("%d", &number);

    cnt = 0; /*initialize index to zero*/
    while (number > 0) {
        oct[cnt] = number % 8;
        number = number / 8;
        cnt++;
    }

    /*print value in reverse order*/
    printf("Octal value is: ");
    for (i = (cnt - 1); i >= 0; i--)
        printf("%d", oct[i]);

    return 0;
}

Output:

    Enter decimal number: 545
    Octal value is: 1041

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now

A PHP Error was encountered

Severity: Warning

Message: Unknown: Failed to write session data (user). Please verify that the current setting of session.save_path is correct (/var/cpanel/php/sessions/ea-php56)

Filename: Unknown

Line Number: 0