What will be the output of the following program ?
a) # include
void main ( )
{
long number = 7866372, result = 0 ;
do
{ result * = 10 ;
int digit = number % 10 ;
result + = digit ;
number / = 10 ;
}
while (number) ;
cout << "output =" << result << endl;
}
b) void main ( )
{
int i = 0, a = 0, b = 0, c = 0, f = 0 ;
while ( i < = 5)
{
switch (i + +)
{
case 1 :
case 2 : + + a ; break;
case 3 :
case 4 : + + b ; break;
case 5 : + + c ; break;
default : + + f ; break;
}
}
cout << a << "\n" ;
cout << b << "\n" ;
cout << c << "\n" ;
cout << f << "\n" ; }
Answers
Answered by
2
What will be the output of the following program ?
a) # include
void main ( )
{
long number = 7866372, result = 0 ;
do
{ result * = 10 ;
int digit = number % 10 ;
result + = digit ;
number / = 10 ;
}
while (number) ;
cout << "output =" << result << endl;
}
b) void main ( )
{
int i = 0, a = 0, b = 0, c = 0, f = 0 ;
while ( i < = 5)
{
switch (i + +)
{
case 1 :
case 2 : + + a ; break;
case 3 :
case 4 : + + b ; break;
case 5 : + + c ; break;
default : + + f ; break;
}
}
cout << a << "\n" ;
cout << b << "\n" ;
cout << c << "\n" ;
cout << f << "\n" ; }
PLEASE MAKE ME AS A BRAINLIST ANSWER
Similar questions
Math,
6 months ago
Computer Science,
1 year ago