URI Online Judge 1009 | (Salary with Bonus) Solution

Solve of URI 1009 (Salary with Bonus) in C & C++


Problem Description of URI Online Judge 1009:


Problem number:
 1009.
Problem name: Salary with Bonus.
Problem level: 2.
Problem category: Beginner.
Points: 2.5 points
Base time limit: 1 second.
Memory limit: 200 MB.
Problem subject: Sequential.
Problem adapted by: Neilor Tonin (Brazil).
Link: https://www.urionlinejudge.com.br/judge/en/problems/view/1009
Solution language: C & C++
My profile: https://www.urionlinejudge.com.br/judge/en/profile/38770


Solution of URI 1009 in C:


//URI online judge 1009 solution in C
//This solution is made and uploaded by Mehedi Hasan Kajol 

#include<stdio.h>
int main(void){
    double salary, totalSell, totalSalary;
    char employeeName[10];
    gets(employeeName);
    scanf("%lf %lf", &salary, &totalSell);
    totalSalary = salary + totalSell * 0.15;
    printf("TOTAL = R$ %.2lf\n", totalSalary);
    return 0;
}


Solution of URI 1009 in C++:


//URI online judge 1009 solution in C++
//This solution is made and uploaded by Mehedi Hasan Kajol 

#include<iostream>

using namespace std;
int main(void){
    double salary, totalSell, totalSalary;
    string employeeName;
    cin >> employeeName;
    cin >> salary >> totalSell;
    totalSalary = salary + totalSell * 0.15;
    printf("TOTAL = R$ %.2lf\n", totalSalary); //printf() for precision
    return 0;
}


Post a Comment

Previous Post Next Post