Предмет: Информатика, автор: TIKTAK6828

Даны 3 числа. Определить, является ли хоть одно из чисел равным нулю. Если есть нулевые значения, то вывести количество чисел, равных нулю. в C#

Ответы

Автор ответа: AnonimusPro
1

using System;

namespace ConsoleApp6

{

   class Program

   {

       static void Main(string[] args)

       {

           int x, y, z, k=0;

           x = int.Parse(Console.ReadLine());

           y = int.Parse(Console.ReadLine());

           z = int.Parse(Console.ReadLine());

           if (x == 0)

               k++;

           if (y == 0)

               k++;

           if (z == 0)

               k++;

           if (k==0)

               Console.WriteLine("среди чисел нулей нет");

           else

               Console.WriteLine("кол-во чисел равных 0: " + k.ToString());

           Console.ReadKey();

       }

   }

}

Похожие вопросы
Предмет: Английский язык, автор: pecko
I. For statements (1-6) write T if the statement is true according to the text, F if it is false
1. Mark Twain is a pen name of Samuel Clemens.
2. Samuel was a teenager when his family moved to Hannibal, a town on the Mississippi River.
3. Samuel began to work after his fathers death.
4. Mark Twain became very famous when his story ‘The Celebrated Jumping Frog of Calaveras County’ was published in 1865.
5. ‘The Adventures of Huckleberry Finn’ was one of the first novels to feature the everyday language of its characters.
6. Mark Twain earned a lot of money and invested it successfully.

II. Choose the correct answer
1. How many children did the writer`s parents have?
a) Three
b) Four
c) Six
d) Seven
2. Why did Samuel become a printer’s apprentice at the Missouri Courier?
a) Because he dreamed of having this job.
b) Because he wanted to help his family.
c) Because he could earn a lot of money doing this job.
d) Because this job was very interesting for him.
3. While creating articles and sketches for the newspaper Samuel became known
a) for his humour
b) for using public libraries for educating himself
c) thanks for his brother Orion’s newspaper
d) for using everyday language
4. What led Mark Twain to writing ‘river novels’ for children?
a) Becoming a father
b) Childhood memories
c) Love for children
d) Love to the river
5. Which book was published after ‘The Adventures of Tom Sawyer’
a) ‘The Innocents Abroad’
b) ‘The Prince and the Pauper’
c) ‘Life on the Mississippi’
d) ‘The Adventures of Huckleberry Finn’
6. Why did Mark Twain begin a world tour in 1895?
a) Because he liked travelling.
b) Because he needed money.
c) Because he wanted to get new impressions.
d) Because he wanted to meet different people.