155k views
2 votes
Declare and initialize the following variables: monthOfYear, initialized to the value 11 companyRevenue, initialized to the value 5666777 firstClassTicketPrice, initialized to the value 6000 totalPopulation, initialized to the value 1222333

1 Answer

6 votes

Answer:

int monthOfYear=11;

long companyRevenue=5666777;

int firstClassTicketPrice=6000;

long totalPopulation=1222333;

Step-by-step explanation:

Here we have declared four variable monthOfYear , companyRevenue, firstClassTicketPrice , totalPopulation as int ,long, int and long type .We have declared companyRevenue,totalPopulation as long type because it exceed the range of integer.

Following are the program in c language

#include <stdio.h> // header file

int main() // main function

{

int monthOfYear=11; // variable

long companyRevenue=5666777; //variable

int firstClassTicketPrice=6000;//variable

long totalPopulation=1222333;//variable

printf("%d\\%ld\\%d\\%ld",monthOfYear,companyRevenue,firstClassTicketPrice,totalPopulation); // display value

return 0;

}

Output:

11

5666777

6000

1222333

User Dirk Smaverson
by
7.4k points