Good evening. The task is to enter a number and enter a number system. And get a string containing the decimal notation.
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int n; int a; char buffer[20]; printf("Vvedite chislo\n"); scanf("%d",&a); do { printf("Sistema schisleniya \n"); scanf("%d",&n); itoa(a,buffer,10); } while(n>10 || n<0); printf("Chislo = %s\n", buffer); system ("pause"); return 0; } Here is the code, but the program does not work correctly. I can not find a mistake. How to fix it?
bufferagain and again in a loop, overwriting everything that was already in it at each iteration. - ߊߚߤߘ