kirililchev3

PhotoGallery - date,time,byte,kb,mb

May 27th, 2018
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.68 KB | None | 0 0
  1. using System;
  2.  
  3. namespace P03_PhotoGallery
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int photoNum = int.Parse(Console.ReadLine());
  10.             int day = int.Parse(Console.ReadLine());
  11.             int month = int.Parse(Console.ReadLine());
  12.             int year = int.Parse(Console.ReadLine());
  13.             int hours = int.Parse(Console.ReadLine());
  14.             int minutes = int.Parse(Console.ReadLine());
  15.             int photoSize = int.Parse(Console.ReadLine());
  16.             int width = int.Parse(Console.ReadLine());
  17.             int height = int.Parse(Console.ReadLine());
  18.  
  19.             Console.WriteLine($"Name: DSC_{photoNum:d4}.jpg");
  20.             Console.WriteLine("Date Taken: {0:d2}/{1:d2}/{2} {3:d2}:{4:d2}", day, month, year, hours, minutes);
  21.  
  22.             if (photoSize<1000)
  23.             {
  24.                 Console.WriteLine("Size: {0}B", photoSize);
  25.             }
  26.             else if (photoSize < 1000000)
  27.             {
  28.                 photoSize /= 1000;
  29.                 Console.WriteLine("Size: {0}KB", photoSize);
  30.             }
  31.             else
  32.             {
  33.                 photoSize /= 1000000;
  34.                 Console.WriteLine("Size: {0}MB", photoSize);
  35.             }
  36.  
  37.             if (width > height)
  38.             {
  39.                 Console.WriteLine($"Resolution: {width}x{height} (landscape)");
  40.             }
  41.             else if (height>width)
  42.             {
  43.                 Console.WriteLine($"Resolution: {width}x{height} (portrait)");
  44.             }
  45.             else if (height == width)
  46.             {
  47.                 Console.WriteLine($"Resolution: {width}x{height} (square)");
  48.             }
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment