Respuesta :
Answer:
The c# program is given below.
using System;
class GreenvilleRevenue
{
static void Main() {
// variable declared and initialized simultaneously
int fees = 25;
int last, present, rev;
Console.WriteLine( "Enter the number of contestants participating in last year’s competition " );
last = Convert.ToInt32(Console.ReadLine());
Console.WriteLine( "Enter the number of contestants participating in this year’s competition " );
present = Convert.ToInt32(Console.ReadLine());
Console.WriteLine( "Number of Participants in last year's competition \t\t" + last);
Console.WriteLine( "Number of Participants in present year's competition \t" + present);
rev = present*fees;
Console.WriteLine( "Revenue expected in this year’s competition is \t\t\t$" + rev );
if(last < present)
Console.WriteLine( "Participants are more this year" );
else if(last > present)
Console.WriteLine( "Participants are less this year" );
else if(last == present)
Console.WriteLine( "Participants are same both years" );
}
}
OUTPUT
Enter the number of contestants participating in last year’s competition
111
Enter the number of contestants participating in this year’s competition
123
Number of Participants in last year's competition 111
Number of Participants in present year's competition 123
Revenue expected in this year’s competition is $3075
Participants are more this year
Explanation:
This program takes input from the user. The input is not validated as this is not mentioned in the question.
1. An integer variable is declared and initialized by the fees of this year’s competition.
2. Integer variables are declared to store participants for last year, present year and revenue earned in the present year.
3. User enters the number of participants in last year’s competition.
4. User enters the number of participants in this year’s competition.
5. All the input from the user is displayed.
6. The revenue earned in this year’s competition is computed and displayed.
7. The message is also displayed whether number of participants this year is greater or not than the last year.
8. Also, if participants are same in both years, the message is displayed accordingly.