Advertisement
Nattack

Untitled

Feb 20th, 2012
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <cstdio>
  2. #include <iostream>
  3. #include <cstdlib>
  4.  
  5. using std::cout;
  6. using std::endl;
  7.  
  8. int main(int argc, char **argv)
  9. {
  10.     double sum=0;
  11.  
  12.     if(argc > 1)
  13.     {
  14.         for(int i = 1; i < argc; i++)
  15.             sum+= atof(argv[i]);
  16.         cout<< "Sum is " << sum << endl;
  17.     } else {
  18.         cout<< "No numbers" << endl;
  19.     }
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement