A bin2dec converter
A binary to decimal converter
AI
Podsumowanie AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Kod źródłowy
/* Binary to decimal converter * * by : koby * [email protected] * If you like this code, visit my site * http://www.codecraft.tk */ #include <stdio.h> #include <math.h> int main(void) { int dec=0, flag=0.0; int bin, bit; double exp=0.0; printf("Enter a binary number : "); scanf("%d", &bin); while(bin) { bit=bin%10; if(bit!=0 && bit!=1) { flag=1; } bin=bin/10; dec=dec+bit*pow(2, exp); exp++; } if(flag) {printf("\n+++ Not a binary number !!!\n");} else {printf("\n+++ Number in decimal : %d\n", dec);} return 0; } This function accepts the input date and the weekending day (Sun=1.....Sat=7). If the weekday of the input date is the same as the weekending day it returns the input date Function weekendday(inputdate, day) If Weekday(inputdate) > day Then inputdate = inputdate + 7 End If weekendday = inputdate + (day - Weekday(inputdate)) End Function
Oryginalne komentarze (3)
Odzyskane z Wayback Machine