Skip to content

Instantly share code, notes, and snippets.

@ahfoukou
Last active December 10, 2015 19:58
Show Gist options
  • Save ahfoukou/4484750 to your computer and use it in GitHub Desktop.
Save ahfoukou/4484750 to your computer and use it in GitHub Desktop.
malakia noumer 2
#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