Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 4th, 2012  |  syntax: None  |  size: 0.42 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. # include <stdio.h>
  2. # include <stdlib.h>
  3.  
  4. int Contardig(int x)
  5. {
  6.     int y,cont=0,aux;
  7.     while (x!=0)
  8.     {
  9.       aux=x%10;
  10.       x=x/10;
  11.       cont++;
  12.     }
  13.     return cont;
  14. }
  15.  
  16. int main () {
  17.         int n,dig;
  18.         printf("ingrese numero: \n");
  19.         scanf("%d",&n);
  20.         dig=Contardig(n);
  21.         printf("el numero %d tiene %d de digitos\n",n,dig);
  22.         system("pause");
  23.         return 0;
  24. }