summaryrefslogtreecommitdiff
path: root/sem_3/Programm/TP2/exo10/exo10.c
blob: fc2f92eab20f8e429a98de4b40ebd2859f9772d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <stdlib.h>
#include <stdio.h>

int puiss (int x, int y) {
  return ( y == 0 ? 1 : x * ( puiss(x, y-1)));
}

int main ( int argc, char ** argv) {
  int lg = 0; int ret =0;
  while (argv[1][lg]!=0) {
    lg ++;
  }
  lg --;
  for ( int i=lg; i >= 0; i --) {
    ret += puiss(10,lg-i)*((int)(argv[1][i] )- 48);
  }
  printf("%d \n", ret);
  return 0;
}