Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <locale.h>
- #include <stdbool.h>
- int main() {
- setlocale(0, "");
- do {unsigned int m,n,res=0;
- char yes="y";
- printf("Введите количество натуральных чисел n:\n");
- scanf("%d",&n);
- printf("Введите значение m:\n");
- scanf("%d",&m);
- if(m>n){
- printf("Недопустимый ввод данных!");
- }
- for (unsigned int i = 1; i < n; ++i) {
- if (i % 5 == 0 && i % m != 0)
- res += i;
- }printf("%d\n",res);
- printf("продолжить работу?(y/n)?\n");
- scanf("%c",&yes);
- }while(yes=='y');
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment