Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Laboratorio 4
Laboratorio 4
Problema 1
Dado el siguiente código realice la traza del programa utilizando el GDB.
Complete la tabla adjunta.
#include <stdio.h>
main()
{
int a[10],b[10],m=0,i,j,k,l;
a[0]=0;
for(i=0;i<8;i++)
{ a[i+1]=a[i]+1;
b[i]=a[i]*a[i];
}
while (m<=10)
{
for(j=1;j<=5;j++)
{ m++;
k=4*j+10+m+b[j-1]-a[j-1]*a[j-1];
if(k>25) continue;
l=(m+5)/2*k-3*m*m;
printf("%d %d %d %d %d\n",i,j,k,l,m);
}
if(l<-220) break;
printf("%d\n",m);
}
}
Given two integers n and m, count the number of pairs of integers (a,b) such that 0<a<b<n and
(a2+b2+m)/(ab) is an integer.
INPUT
You will be given a number of cases in the input. Each case is specified by a line containing the
integers n and m. You may assume that 100n>0.
OUTPUT
For each case, print the case number as well as the number of pairs (a,b) satisfying the given
property. Print the output for each case on one line in the format as show below.