Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. /*1. Stwórz funkcję int Suma1(int a, int b, int c), która w pętli obliczy sumę kolejnych
  2. wyrazów ciągu arytmetycznego o różnicy c, mniejszych od b.Pierwszy wyraz ciągu: a.*/
  3. static int Suma1(int a, int b, int c)
  4. {
  5. while (a <b)
  6. {
  7. return a + Suma1( a + c, b,c);
  8.  
  9. }
  10. return 0;
  11. }
  12. static void Main(string[] args)
  13. {
  14. Console.WriteLine("Zadanie 1");
  15. Console.WriteLine("Suma wynosi" + Suma1(1, 10, 1));
  16. Console.ReadKey();
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement