What is the output of this program? #include<iostream> int main() { int k=6,m=1; k-=k; m=m+k; cout<<k<<" "<<m; return 0; } | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What is the output of this program? #include<iostream> int main() { int k=6,m=1; k-=k; m=m+k; cout<<k<<" "<<m; return 0; }

Simple game.

20th Aug 2016, 10:07 AM
Muhammed cp
Muhammed cp - avatar
17 Answers
+ 3
Output is : 0 1
20th Aug 2016, 12:29 PM
Programmer
+ 3
Balaji name space is needed for simple program??
20th Aug 2016, 2:25 PM
Muhammed cp
Muhammed cp - avatar
+ 2
bro,i think the output is : 0 1
20th Aug 2016, 10:33 AM
balaji
balaji - avatar
+ 2
and give namespace std;
20th Aug 2016, 10:34 AM
balaji
balaji - avatar
+ 2
0 1
20th Aug 2016, 10:35 AM
Anvar
Anvar - avatar
+ 2
k=0
20th Aug 2016, 2:40 PM
The hacker
+ 2
m=1
20th Aug 2016, 2:40 PM
The hacker
+ 2
No output. Compile Error. without "using namespace std;" or using "std::cout" instead of "cout"
20th Aug 2016, 3:36 PM
kiwiyou
kiwiyou - avatar
+ 2
k=0 m=1
20th Aug 2016, 4:38 PM
kiky
+ 1
so the output is : 0 1
20th Aug 2016, 2:41 PM
The hacker
+ 1
Yup the answer is 0 1
20th Aug 2016, 2:43 PM
Muhammed cp
Muhammed cp - avatar
+ 1
out put is k=0 M=1
20th Aug 2016, 3:27 PM
Vijay Kumar
Vijay Kumar - avatar
+ 1
out put is k=0 M=1
20th Aug 2016, 3:27 PM
Vijay Kumar
Vijay Kumar - avatar
+ 1
why k = 0 and m = 1 .can anyone explain??
21st Aug 2016, 2:51 AM
Jewel Mahmud Nimul Shamim
Jewel Mahmud Nimul Shamim - avatar
+ 1
initially k=6 & m=1 then k-=k => k=k-k => 6-6=0 m=m+k => 1+0 = 1. so k=0 and m=1
21st Aug 2016, 3:57 AM
Muhammed cp
Muhammed cp - avatar
0
dont know
20th Aug 2016, 10:32 AM
Mr.lonely
Mr.lonely - avatar
0
kiwiyo tanks for your information.
20th Aug 2016, 5:32 PM
Muhammed cp
Muhammed cp - avatar