Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>        
  2. #include <cstdio>
  3. #include <math.h>
  4.  
  5.            
  6. using namespace std;
  7.            
  8. int n,liczba,c;        
  9. float sn=0,fx;
  10.  
  11. int main()             
  12. {  
  13. cin>>n;
  14.  
  15. for(int i=1; i<=n; i++)
  16. {
  17.  
  18. while(1)
  19. {
  20. c=i/2;
  21. if (c=1){
  22. fx=i*i;
  23. cout<<"i=  "<<i<<endl<<"    fx= "<<fx<<endl; break;  
  24. }          
  25. else if (c=0){
  26. fx=i+100;
  27. cout<<"i=  "<<i<<endl<<"    fx= "<<fx<<endl;} break;
  28. }
  29. sn=sn+fx;
  30. }
  31.  
  32. cout<<"suma= "<<sn;
  33.  
  34.    system("PAUSE");
  35.    return 0;
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement