Need to fix program. Should give the AND of the inputted numbers. #include <iost
ID: 3635003 • Letter: N
Question
Need to fix program. Should give the AND of the inputted numbers.#include <iostream>
void main();
{
int i;
int k;
cout<<"Enter 0 (false) or 1 (true) for the first value: "<<endl;
cin>> i;
cout<<"Enter 0 (false) or 1 (true) for the second value: "<<endl;
cin>> k;
cout<<"AND"<<endl;
cout<<"k | 0 |1"<<endl;
cout<<"--- | --- | ---"<<endl;
cout<<"0 | 0 |0"<<endl;
cout<<"1 | 0 | 1"<<endl;
if (i==1&k==1)
cout<<"Result is TRUE"<<endl;
else
cout<<"Result is FALSE"<<endl;
}
Explanation / Answer
Please Rate:Thanks
#include <iostream.h>
void main()
{
int i;
int k;
cout<<"Enter 0 (false) or 1 (true) for the first value: "<<endl;
cin>> i;
cout<<"Enter 0 (false) or 1 (true) for the second value: "<<endl;
cin>> k;
cout<<"AND"<<endl;
cout<<"k | 0 |1"<<endl;
cout<<"--- | --- | ---"<<endl;
cout<<"0 | 0 |0"<<endl;
cout<<"1 | 0 | 1"<<endl;
if (i==1&&k==1)
cout<<"Result is TRUE"<<endl;
else
cout<<"Result is FALSE"<<endl;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.