Answer:
The program to this question can be given as:
Program:
#include <iostream>//header file.
using namespace std; //using namespace
int main() //main function.
{
int value=28, x=1; //define variable.
cout<<"divisors of "<< value <<":"; //print value.
while (x <= value) //loop
{
if ((value % x) ==0) //if block
cout<<" "<<x; //print value
x++; //increment value.
}
return 0;
}
Output:
divisors of 28: 1 2 4 7 14 28
Explanation:
The description of the above c++ program can be given as:
So, the output of this program is "1 2 4 7 14 28".
Answer:
int monthOfYear=11;
long companyRevenue=5666777;
int firstClassTicketPrice=6000;
long totalPopulation=1222333;
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\n%ld\n%d\n%ld",monthOfYear,companyRevenue,firstClassTicketPrice,totalPopulation); // display value
return 0;
}
Output:
11
5666777
6000
1222333