chap 4 notes 4 - if n!= ave = sum n cout<<...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
4 if Statement Example # include <iostream> using namespace std; int main( void ) { int ave= 0 , sum= 0 , n; cout << "Enter sum : " ; cin >> sum; cout << endl << "Enter the count : " ; cin >> n;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: if ( n != ) { ave = sum / n; } cout << endl << "Average is : " << ave << endl; return 0; } Since n != 0 ( n is not zero), the expression is true, and ave = sum/n ....
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online