123 Eng

### Engineering the engineers™

Home
Source Codes
Engineering Colleges

Training  Reports
Seminar Reports
Placement Papers

Forums

Computer Science / IT
Electronics
Electrical
Mechanical
Chemical
Civil

CAT / MBA

GMAT / Foreign MBA
Latest Jobs

Displaying  Source Code(s)

 Base Conversion Program any base to any base -------------------------------------------------------------------------------- Description : With this program you can convert the base of a real number. This program works on any base. /*PROGRAM TO CONVERT BASE OF A NUMBER (DECIMAL POINT ALSO)*/ /*THIS PROGRAM CONTAINS VALIDATION CHECKS ALSO*/ /*DESIGNED AND OWNED BY "KALYAN" */ /*TOTAL NO OF LINES-----158*/ #include #include #include #include #include float decimal; main() { char ch,s[33],s1[33],s2[33],*p,dot; int m,n,a1[33],a2[33],b,i,k,l; float f=0,deci=0,z=0; clrscr(); printf("Enter Base of number you want:(2,8,10,16)"); scanf("%d",&b); if(b==2||b==8||b==10||b==16) { printf("Enter Number :"); scanf("%s",&s); l=strlen(s); } else { printf("INVALID BASE......."); main(); } /*validation check for number*/ for(i=0;i<=l;i++) { switch(b) { case 2 : { if(strchr("01.",s[i])==NULL) { printf(" Invalid number.... Again enter the number:"); scanf("%s",&s); } break; } case 8: { if(strchr("01234567.",s[i])==NULL) { printf(" Invalid number.... Again enter the number:"); scanf("%s",&s); } break; } case 10 : { if(strchr("0123456789.",s[i])==NULL) { printf(" Invalid number.... Again enter the number:"); scanf("%s",&s); } break; } case 16 : { if(strchr("0123456789ABCDEF.",s[i])==NULL) { printf(" Invalid number.... Again enter the number:"); scanf("%s",&s); } break; } } } p=strchr(s,'.'); k=p-s; for(i=0;i<=l-1;i++) { if(i>k) s2[i-(k+1)]=s[i]; else s1[i]=s[i]; } s2[i-k-1]='

Contribute content or training reports / feedback / Comments
job placement papers