ProgIng - Programación en Ingeniería
Loading...
Searching...
No Matches
Ejemplo030.c File Reference
#include <stdio.h>
Include dependency graph for Ejemplo030.c:

Go to the source code of this file.

Functions

int buscar (int n)
int main (int argc, char *argv[])

Function Documentation

◆ buscar()

int buscar ( int n)

Definition at line 3 of file Ejemplo030.c.

4{
5 return n%2?n:buscar(n/2);
6}
int buscar(int n)
Definition Ejemplo030.c:3
Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( int argc,
char * argv[] )

Definition at line 8 of file Ejemplo030.c.

9{
10 int n, a, b, i, j, x;
11 scanf("%d", &n);
12 for(i=0; i<n; i++)
13 {
14 scanf("%d %d", &a, &b);
15 for(j=a, x=0; j<=b; j++)
16 {
17 printf("%d (%d)\t", j, buscar(j));
18 x += buscar(j);
19 }
20 printf("%d\n", x);
21 }
22 return 0;
23}
Here is the call graph for this function: