Advertisement
Guest User

Untitled

a guest
Oct 18th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.60 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Exercise4
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             Console.Write("Vyvedi n:");
  10.             double n = double.Parse(Console.ReadLine());
  11.             double sum;
  12.             int devided = 0;
  13.  
  14.  
  15.             for (int i = 1; i <= n; i++)
  16.             {
  17.                 sum = Math.Pow(i, 3) + 3 * i + n;
  18.  
  19.                 if(sum % 17 == 0)  
  20.                 {
  21.                     devided++;
  22.                 }
  23.             }
  24.  
  25.             Console.WriteLine("Broi na chislata kratni na '17': {0}",devided);
  26.  
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement