HRyk
Junior Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору vor76, разбирайся: №3 #include "stdafx.h" #include <conio.h> #include <math.h> int _tmain(int argc, _TCHAR* argv[]) {int c,i,a[20]; double st=0,pr=0; printf("Vvedite chislo: "); scanf("%d",& c); if (c==0) printf("0"); i=0; while (c!=0) { a[i]=c%10; if (a[i]!=0) pr=pr+pow(2,st); st=st+1; c=c/10; i=i+1; } printf("otv==%.0lf",pr); getch(); return 0; } №2 #include "stdafx.h" #include <conio.h> #include <math.h> int _tmain(int argc, _TCHAR* argv[]) {int c,p,i,a[20],j; char s[10]; printf("Vvedite chislo: "); scanf("%d",& c); printf("Vvedite pokazatel sist schisl: "); scanf("%d",& p); if (c==0) printf("0"); i=0; while (c!=0) { a[i]=c%p; c=c/p; i=i+1; } for (j=i-1;j>=0;j--) printf("%x",a[j]); getch(); return 0; } | Всего записей: 162 | Зарегистр. 04-11-2006 | Отправлено: 13:51 15-02-2007 | Исправлено: HRyk, 13:52 15-02-2007 |
|