Advertisement
YavorGrancharov

Photo_Gallery

Jun 7th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.60 KB | None | 0 0
  1. using System;
  2.                    
  3. public class Program
  4. {
  5.     public static void Main()
  6.     {
  7.         int photoNumber = int.Parse(Console.ReadLine());
  8.         int day = int.Parse(Console.ReadLine());
  9.         int month = int.Parse(Console.ReadLine());
  10.         int year = int.Parse(Console.ReadLine());
  11.         int hours = int.Parse(Console.ReadLine());
  12.         int minutes = int.Parse(Console.ReadLine());
  13.         double photoSize = double.Parse(Console.ReadLine());
  14.         int width = int.Parse(Console.ReadLine());
  15.         int height = int.Parse(Console.ReadLine());
  16.        
  17.         int resolution = width * height;;
  18.        
  19.         string size = "";
  20.        
  21.         if (photoSize < 1000)
  22.             {
  23.             size = "B";
  24.             }
  25.             else if (photoSize < 1000000)
  26.             {
  27.                 photoSize /= 1000;
  28.                 size = "KB";
  29.             }
  30.             else
  31.             {
  32.                 photoSize /= 1000000;
  33.                 size = "MB";
  34.             }
  35.        
  36.         string orientation = "";
  37.        
  38.         if (height < width) {
  39.             orientation = "landscape";
  40.         }
  41.         else if (width < height) {
  42.             orientation = "portrait";
  43.         }
  44.         else {
  45.             orientation = "square";
  46.         }
  47.        
  48.         if (minutes > 59)
  49.             {
  50.                hours = hours + 1;
  51.                minutes = minutes - 60;
  52.             }
  53.  
  54.             if (hours > 23)
  55.             {
  56.                hours = 0;
  57.             }
  58.        
  59.         Console.WriteLine($"Name: DSC_{photoNumber:D4}.jpg");
  60.         Console.WriteLine($"Date Taken: {day:D2}/{month:D2}/{year:D4} {hours:D2}:{minutes:D2}");
  61.         Console.WriteLine($"Size: {photoSize.ToString("0.#")}{size}");
  62.         Console.WriteLine($"Resolution: {width}x{height} ({orientation})");
  63.     }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement