Advertisement
Guest User

dort_basamaklı_çarpım

a guest
Oct 13th, 2015
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.83 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 ConsoleApplication19
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             for (int i = 1000; i <= 9999; i++)
  14.             {
  15.                 string sayi = i.ToString();
  16.                 string tersi = "";
  17.  
  18.                 for (int k = 3; k >= 0; k--)
  19.                 {
  20.                     tersi = tersi + sayi[k].ToString();
  21.                 }
  22.  
  23.                 if (Convert.ToInt32(tersi) * 4 == Convert.ToInt32(sayi))          //Convert.ToInt32(tersi) * 4 == i  
  24.                 {
  25.                     Console.WriteLine("Bulunan sayı: {0}'dir", i);
  26.                     break;
  27.                 }
  28.             }
  29.             Console.ReadLine();
  30.  
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement