Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- public class Main {
- public static void main(String[] args) {
- System.out.println("Таблица цены сыра:\n ________________\n
- |цена |стоимость|\n|______|_________|");
- int weight, price = 280, price1;
- for (weight =50; weight <= 1000; weight += 50)
- {
- price1 = weight * price / 1000;
- System.out.print("|" + weight + "г");
- if (weight < 100)
- System.out.println(" |" + price1 + "р |");
- else
- if (weight < 400)
- System.out.println(" |" + price1 + "р |");
- else
- if (weight < 1000)
- System.out.println(" |" + price1 + "р |");
- else
- System.out.println(" |" + price1 + "р |");
- System.out.println("|______|_________|");
- }
- }
- }
Add Comment
Please, Sign In to add comment