Input, your program should read the lines from standard input, each line contains a positive integer,
Output: the input of each line, will be of Numbers from 1 to n, and output to standard output, ignore those Numbers can be divided exactly by 5, and 7, print out each result in the new row,
CodePudding user response:
Then your code?CodePudding user response:
Write programs as required to
/* -
* Copyright (C), 1999-2019, mymtom.
* _
* ____ _ _ ____ _ | | _ _____ _____
* | \ | | | | (_ _) _ \ | \
* | | | | | _ | | | | | | | | | _ | | | | |
* | _ | _ _ - | | \ | _ | _ _ - | | \ () ___/| _ | _ | _ |
* (____/
*
* https://bbs.csdn.net/topics/395126735
*/
/* *
* @ file sum. CPP
* @ brief,
*/
#include
using namespace std;
#include
Static int
The sum (int last)
{
Int total;
Total=0;
For (int number=1; Number & lt;=last; Number++) {
If (number % 5==0 | | number % 7==0)
continue;
Total +=number;
}
Return the total;
}
Int
The main (void)
{
The string line;
While (getline (cin, line)) {
Cout & lt;}
return 0;
}
CodePudding user response:
I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10581430.htmlI hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10768339.html