Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* a
- #include <iostream>
- using namespace std;
- int main()
- {
- unsigned long n,E=0,nr,i=1,cif1,cif2;
- cin>>n;
- while (i<=n)
- {
- cif1=i;
- cif2=i+1;
- nr=cif1*10+cif2;
- i++;
- E+=nr;
- }
- cout<<E;
- return 0;
- }
- //*/
- /// e=12+23+34+....+nr(n(n+1))
- /* b
- #include <iostream>
- using namespace std;
- int main()
- {
- unsigned long n,E=0,nr=0,i=1,nrant=0;
- cin>>n;
- while (i<=n)
- {
- nr=nr*10+i;
- E+=nr;
- if (nr==0)
- nr=1;
- i++;
- }
- cout<<E;
- return 0;
- }
- //*/
- /// e=1+12+123+1234+...nr(1234...n)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement