# URI Online Judge Solution 1038 Snack – Solution in C, C++, Java, Python and C#

### URI Online Judge Solution 1038 Snack – Solution in C, C++, Java, Python and C#

URI Online Judge Solution 1038 Snack | Beginner

Problem Name: 1038 Snack Solution
Problem Number : URI – 1038 Snack Code
Online Judge : URI Online Judge Solution
Category: Beginner
Solution Language : C,C plus plus, java, python, c#(c sharp)

### URI 1038 Snack Code in C / URI 1038 Snack solution in C:

`#include<stdio.h>int main(){    int X, Y;    float price = 0;    scanf("%d %d", &X, &Y);    if (X == 1)    {        price  = (float) (4.00 * Y);    }    else if (X == 2)    {        price  = (float) (4.50 * Y);    }    else if (X == 3)    {        price  = (float) (5.00 * Y);    }    else if (X == 4)    {        price  = (float) (2.00 * Y);    }    else if (X == 5)    {        price  = (float) (1.50 * Y);    }    printf("Total: R\$ %.2fn",price);}`

### URI 1038 Snack Code in C++ / URI 1038 Snack solution in CPP:

`#include <iostream>#include <iomanip>using namespace std;int main(){ int t; float q; cin >> t >> q; if(t == 1){  q *= 4.0;  }else if(t == 2){  q *= 4.5; }else if(t == 3){  q *= 5.0; }else if(t == 4){  q *= 2.0; }else{  q *= 1.5; } cout << "Total: R\$ " << setprecision(2) <<  fixed << q << endl; return 0;}`

### URI 1038 Snack Code in java/ URI 1038 Snack solution in Java:

`import java.io.IOException;import java.util.Scanner;public class Main {     public static void main(String[] args) throws IOException {        int X, Y;  float price = 0;    Scanner input = new Scanner(System.in);  X = input.nextInt();  Y = input.nextInt();  if (X == 1) {   price  = (float) (4.00 * Y);  }else if (X == 2) {   price  = (float) (4.50 * Y);  }else if (X == 3) {   price  = (float) (5.00 * Y);  }else if (X == 4) {   price  = (float) (2.00 * Y);  }else if (X == 5) {   price  = (float) (1.50 * Y);  }    System.out.printf("Total: R\$ %.2fn",price);     } }`

### URI Solution 1038 Snack Code / URI 1038 Snack solution in  C# (C Sharp):

Demonstration:

Just implement this in coding. Since having any problem just put a comment below. Thanks

Tags: URI Online Judge Solution, URI OJ Solution list, URI Problems Solution, URI solver, URI all problem solution list, URI Snack code in C, URI 1038 Snack code in C++, URI Snack of a circle solution in C, URI solution, URI 1038 Snack solution in C,URI 1038 Snack solution in C++-CPP,URI 1038 Snack solution in C# (C sharp),URI 1038 Snack solution in Java,URI 1038 Snack solution in Python,

#### By Maniruzzaman Akash

Maniruzzaman Akash is a freelance web developer with most popular Laravel PHP frameork and Vue JS