Cześć wszystkim.
Jestem nowy w programowanie, i napotkałem się na taki o to problem. Mam taki program . Chciałbym , żeby liczby n, m i c były pobierane od użytkownika, ale nie mam pojęcia jak to zrobić. Z góry dzięki
#include <iostream>
using namespace std;
int suma_c(int x)
{
int s=0;
while (x!=0)
{
s=s+x%10;
x/=10;
}
return s;}
int suma_p(int n, int m, int c)
{
int s=0;
int x=n;
while(x<=m)
{
if(suma_c(x)==c) {s+=x; }
x++;
}
return s;
}
int main()
{
cout <<suma_p();
}