Last active
December 10, 2015 19:58
-
-
Save ahfoukou/4484750 to your computer and use it in GitHub Desktop.
malakia noumer 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
int foo( char c[] ) | |
{ | |
int i , size , d = 0 , j = 1, a; | |
size = strlen(c); | |
for (i = size-1 ; i >= 0; i--) | |
{ | |
a = c[i] - '0'; | |
d = d + ( a * j ); | |
j*=10; | |
} | |
return d; | |
} | |
int main(void) | |
{ | |
int i , number ; | |
char c[5]; | |
for ( i = 0; i < 5; i++) | |
{ | |
printf("dwse to stoixio noumero %d \n ", i ); | |
scanf("%c", &c[i]); | |
fflush(stdin); | |
} | |
number = foo( c ); | |
printf ("%d\n", number); | |
system("pause"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment