Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp3
- {
- class zadanie3
- {
- public static void square(int n)
- {
- int sum = 0;
- for (int i = 1; i <= n; i++)
- {
- sum = sum + (i * i);
- }
- Console.WriteLine(sum);
- }
- }
- static void Main(string[] args)
- {
- int n;
- n = int.Parse(Console.ReadLine());
- if (n < 0)
- {
- Console.WriteLine("n musi byc nieujemne");
- Environment.Exit(0);
- }
- else
- {
- square(n);
- }
- }
- }//tutaj zrobić funkcje
Advertisement
Add Comment
Please, Sign In to add comment