Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Challenge: Scopes | Методи
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Основи C#

bookChallenge: Scopes

Завдання

Swipe to start coding

You want to calculate total sales for a day using local and global variables.

  • Declare a global variable grandTotal (outside any method) to store the total sales.
  • Create a method AddSale that:
    • Declares local variables price and quantity.
    • Calculates the total for that sale and adds it to the global grandTotal.

Рішення

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 6. Розділ 12
single

single

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

close

bookChallenge: Scopes

Свайпніть щоб показати меню

Завдання

Swipe to start coding

You want to calculate total sales for a day using local and global variables.

  • Declare a global variable grandTotal (outside any method) to store the total sales.
  • Create a method AddSale that:
    • Declares local variables price and quantity.
    • Calculates the total for that sale and adds it to the global grandTotal.

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 6. Розділ 12
single

single

some-alt