URI Online Judge 1008 | (Salary) Solution

Solve of URI 1008 (Salary) in C & C++


Problem Description of URI Online Judge 1008:


Problem number:
 1008.
Problem name: Salary.
Problem level: 2.
Problem category: Beginner.
Points: 2.0 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/1008
Solution language: C & C++
My profile: https://www.urionlinejudge.com.br/judge/en/profile/38770


Solution of URI 1008 in C: 


//URI online judge 1008 solution in C
//This solution is made and uploaded by Mehedi Hasan Kajol 
#include<stdio.h>
int main(void){
    int A, hours;
    double salary, totalSalary;
    scanf("%d %d %lf", &A, &hours, &salary);
    totalSalary = (double)hours * salary; //Converting integer into double
    printf("NUMBER = %d\nSALARY = U$ %.2lf\n", A, totalSalary);
    return 0;
}


Solution of URI 1008 in C++:


//URI online judge 1008 solution in C++
//This solution is made and uploaded by Mehedi Hasan Kajol 
#include<iostream>

using namespace std;
int main(void){
    int A, hours;
    double salary, totalSalary;

    cin>> A >> hours >> salary;
    totalSalary = (double)hours * salary; //Converting integer into double

    cout<<"NUMBER = "<<A<<endl;
    printf("SALARY = U$ %.2lf\n", totalSalary); //printf() for precision
    return 0;
}


Post a Comment

Previous Post Next Post