/*编写程序将十进制转化为八进制输出*/
#include <stdio.h>
#define N 50
int main()
{
int num;
char a[N] = {0};
printf("Please input a num :");
scanf ("%d", &num);
int i = 0;
int count = 0;
while (num)
{
count++;
int temp = num % 8;
a[i++] = temp + '0';
num = num / 8;
}
for (i = count - 1; i >= 0; i--)
{
printf ("%c", a[i]);
}
printf ("\n");
return 0;
}
#include <stdio.h>
#define N 50
int main()
{
int num;
char a[N] = {0};
printf("Please input a num :");
scanf ("%d", &num);
int i = 0;
int count = 0;
while (num)
{
count++;
int temp = num % 8;
a[i++] = temp + '0';
num = num / 8;
}
for (i = count - 1; i >= 0; i--)
{
printf ("%c", a[i]);
}
printf ("\n");
return 0;
}