What is the output of the following (when embedded in a complete program)? 1. in
ID: 3533542 • Letter: W
Question
What is the output of the following (when embedded in a complete program)?
1.
int count;
for (int count = 5; count < 15; count ++)
cout << count << ' ';
What is the output?
Rewrite as a loop.
2. int i =1
while (i<=10)
{
if(i<6&&i !=3)
cout<<'*';
}
What is the output?
Rewrite to a (for) loop
Write a pseudocode.
Write a pseudocode for:
int first_choice=1;_
switch(first_choice+1)
{
case1:
cout<<"roast beed ";
break;
case2:
cout<<"roast worms ";
break;
case3
cout<<"chocolate ice cream ";
break;
case4:
cout<<"oinion ice cream ";
default;
cout<<"ban appedtit! ";
}
Write a pseudocode for the following and summarize in the end what this program will do.
int net_income;
double tax_bill, five_percent_tax, ten_percent_tax;
cout<<"enter net income $);
cin>>net_income;
if(net_income<=15000)
tax_bill=0
else if(net_income>15000)&&(net_income<+25000)
tax_bill=0.05*(net_income-15000);
else
{
five_percent_tax=0.05*10000;
ten_percent_tax=0.10*(net_income-25000);
tax_bill=five_percent_tax+ten_percent_tax;
}
cout<<"net income=$<<net_income,,endl;
<<"tax bill =$" <<tax_bill<<endl;
Explanation / Answer
1)
output
5 6 7 8 9 10 11 12 13 14
for(count=5;count<15;count++)
{
cout<<count<<" ";
}
2)output
"*" infinite times loop doesnt stop because value of "i" doesnt change in a loop
while(i<=10)
{
if(i<6&&i!=3)
cout<<"*";
i++;
}
pseudocode
let i=1
while i<=10
if I<6 && I!=3 then
print *
end while
3)
pseudocode
let firstchoice =1
switch firstchoice+1
if firstchoice is 1 then print roast beed
if firstchoice is 2 then print worms
if frstchoice is 3 then print chocolet ice cream
if firstchoice is 4 then print oninon ice cream
else print ban appenit
end switch
4)
program is used to calculate tax on income by different criteria
let net income
if net income <=15000 then
tax =0
if income >15000 and income <25000 then
tax=0.05*9net income-15000)
else
five percent tax= 0.05*(net income-15000)
ten percent tax =0.1*(net income -25000)
tax=five percent tax+ ten percen tax
print net income
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.