MuffinMonster

Class Task 31#

Nov 3rd, 2013
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.80 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication12
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int total = 0, books, price;
  14.             Console.WriteLine("Enter the book's price: ");
  15.             price = int.Parse(Console.ReadLine());
  16.             for (int i = 10; i > 0; i--)
  17.             {
  18.                 Console.Write("Enter the amount of books you've purchased: ");
  19.                 books = int.Parse(Console.ReadLine());
  20.                 total = total + books;
  21.             }
  22.             Console.WriteLine("You've sold " + total + " books! Congratulations!");
  23.             Console.WriteLine("You've earned " + (total * price) + "$");
  24.         }
  25.     }
  26. }
Add Comment
Please, Sign In to add comment