Program ma wypisać na ekranie co 5 sumę spośród sum kolejnych licz całkowitych od 1 do 50
PILNE jak najszybciej
Daje Naj
" Life is not a problem to be solved but a reality to be experienced! "
© Copyright 2013 - 2024 KUDO.TIPS - All rights reserved.
#include <iostream>
using namespace std;
int main()
{
int suma = 0;
for(int x = 1; x <=50; x++)
{
suma = suma + x;
if ((x % 5) == 0)
{
cout << suma << "\n";
suma = 0;
}
}
return 0;
}
http://pastie.org/7814200
#include <iostream>
using namespace std;
int main(){
int a,suma;
suma=0;
for (a=5;a <=50;a+=5){
cout <<"Suma liczb " << suma << " i " << a << " to "<< suma +a << endl;
suma+=a;
}
}
PZDR Marcin!