initial checkin from subversion
This commit is contained in:
42
10tox.c
Normal file
42
10tox.c
Normal file
@@ -0,0 +1,42 @@
|
||||
#include <stdio.h>
|
||||
|
||||
unsigned long base10;
|
||||
int newbase;
|
||||
char swap[100],c[100];
|
||||
unsigned long rest,erg;
|
||||
int pos=0;
|
||||
int i;
|
||||
|
||||
int main()
|
||||
{
|
||||
base10=19990320;
|
||||
newbase=36;
|
||||
|
||||
printf("Zahl im 10er-System:");
|
||||
scanf("%d",&base10);
|
||||
printf("Neues Zahlensystem:");
|
||||
scanf("%d",&newbase);
|
||||
|
||||
c[pos]='0'+rest;
|
||||
while (base10 > 0)
|
||||
{
|
||||
erg=base10/newbase;
|
||||
rest=base10%newbase;
|
||||
if (rest <= 9)
|
||||
c[pos]='0'+rest;
|
||||
else
|
||||
c[pos]='A'+(rest-10);
|
||||
|
||||
base10=erg;
|
||||
pos++;
|
||||
c[pos]='\0';
|
||||
}
|
||||
|
||||
pos--;
|
||||
for (i=0;i<=pos;i++)
|
||||
{
|
||||
swap[i]=c[pos-i];
|
||||
}
|
||||
|
||||
printf("Zahl im %der-system:%s\n",newbase,swap);
|
||||
}
|
||||
Reference in New Issue
Block a user