URI Online Judge | 1010 Simple Calculate

Problem:
https://www.urionlinejudge.com.br/judge/en/problems/view/1010
Solution:
Here I have used array and for loop and defines the array index inside the for loop and while adding the output there i have added the value from array index

Code:

#include<iostream>
#include<cstdio>
int main()
{
int p_code,p_unit[2],i;
float price[2],total;
for(i=0;i<2;i++)
{
    scanf("%d %d %f",&p_code,&p_unit[i],&price[i]);
}
total=((p_unit[0]*price[0])+(p_unit[1]*price[1]));
printf("VALOR A PAGAR: R$ %.2f\n",total);
return 0;
}

 

It would be a great help, if you support by sharing :)
Author: zakilive

Leave a Reply

Your email address will not be published.