+ 1

Why we write sum1=sum2=0 in the calculation program of odd qnd even numbers

Q:-write a program that will calculate the sum of odd numbers and sum of even numbers for numbers 1to 10 ans:- #include<iostream.h> void main( ) { int sum1,sum2; sum1=sum2=0;

10th Mar 2018, 4:20 PM
rajeshbhardwaj
rajeshbhardwaj - avatar
3 Réponses
+ 2
I don't know. It's the same as int sum1 = 0, sum2 = 0; but harder to read. And main can't be a void function. And <iostream> should be included without the h ending. I don't feel like you should copy this answer.
10th Mar 2018, 4:38 PM
Timon Paßlick
+ 2
Which statement do you mean with "but why?"?
10th Mar 2018, 5:04 PM
Timon Paßlick
+ 1
but why?
10th Mar 2018, 4:57 PM
rajeshbhardwaj
rajeshbhardwaj - avatar