Advertisement
filin

laba_2_z_4_mk1

Sep 16th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.03 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 Z_4
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int q = 1;
  14.             int q1 = 1;
  15.             while (q == q1)
  16.             {
  17.                 int count = 0;
  18.                 Console.WriteLine("Введите число: ");
  19.                 string s = Console.ReadLine();
  20.                 s = s.Replace(".", string.Empty);
  21.                 int a = int.Parse(s);
  22.                 while (a > 0)
  23.                 {
  24.                     int b = a % 10;
  25.                     a = a / 10;
  26.                     if (b % 3 == 0)
  27.                     {
  28.                         count += 1;
  29.                     }
  30.                 }
  31.                 Console.WriteLine("count= " + count);
  32.                 Console.WriteLine("Если хотите продолжить то введите 1");
  33.                 q = int.Parse(Console.ReadLine());
  34.             }
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement