 # URI 2694 Solved by C programming

URI Online Judge | 2694

# Problem with the Calculator

By Neilor Tonin, URI | BrazilTimelimit: 1

Joãozinho have to help his father. One specific report are being pressed with unwished letters between the three existing numbers. You have to do a program to sum these three numbers, ignoring the letters existents. Each line have no spaces.

## Input

The first line of input contains an integer N (N < 100000). Follow N lines with exacly 14 characters that must be read and the three number existing in this line must be extracted and summed.

## Output

For each input, your program must print a integer representing the sum of the 3 existent numbers of that line.

Solved by C programming

``````
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{

int t;
scanf("%d",&t);
while(t--)
{
char str,tmp1,tmp2,tmp3;
int l,i,m=0,n=0,o=0,sum=0,num1=0,num2=0,num3=0;
//gets(str);
scanf("%s",str);
l=strlen(str);

for (i=0;i<l;i++)
{
if(i>=2 && i<=3)
{
tmp1[m]=str[i];
m++;
continue;
}
else if(i>=5 && i<=7)
{
tmp2[n]=str[i];
n++;
continue;
}
else if(i>=11 && i<=12)
{
tmp3[o]=str[i];
o++;
continue;
}
}
tmp1[m]='\0';
tmp2[n]='\0';
tmp3[o]='\0';
num1=atoi(tmp1);
num2=atoi(tmp2);
num3=atoi(tmp3);
sum=num1+num2+num3;
printf("%d\n",sum);

sum=0;num1=0;num2=0;num3=0;

}

return 0;

}
``````