ThoughtWorks Interview Question
Software DevelopersCountry: India
the first time
cout<<"\n the value of d is :"<<d
-> return Garbage value.
The second time
cout<<"\n the value of d is :"<<d
-> return c^2.
As additional information -> The input must be in range of data-type 'int' as declared else output will be negative or not reasonable.
if input is :-
5 6
output will be :-
0944293499
121
#include<iostream.h>
- shishu kumar choudhary August 16, 2016#include<conio.h>
#include<math.h>
{
int main(){
clrscr();
int a,b,c ,d;
cout<<"\n enter the value of a and b:";
cin>>a>>b;
c=a+b;
cout<<"\n the value of d is :"<<d;
d = pow(c,2);
cout<<"\n the value of d is:"<<d;
getch();
return 0;
}