Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class Program
- {
- public static void Main()
- {
- Console.Write("Enter a natural number: ");
- int n = int.Parse(Console.ReadLine());
- int broika = 0;
- if (n > 0 && n % 1 == 0)
- {
- for (int i = 0; i <= n; i++)
- {
- Console.Write("Enter a 4-digit natural number: ");
- int num = int.Parse(Console.ReadLine());
- if (num >= 1000 && num <= 9999)
- {
- if (num / 100 % 10 == 0) {
- broika++;
- }
- } else {
- Console.WriteLine("The number that you have entered is not a 4-digit natural number");
- break;
- }
- }
- Console.WriteLine(broika);
- } else
- Console.WriteLine( "The number that you have entered is not natural." ) ; } }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement