Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace Uzd6
- {
- class Program
- {
- //metode Add darbojas šādi: x += y; turklāt tiek pārbaudīts vai operācija Add vispār iespējama.
- //Panākt, lai aktuālā parametra a vērtība pēc metodes izsaukšanas būtu izmainījusies
- public static int add(int x, int y)
- {
- return x + y;
- }
- static void Main(string[] args)
- {
- int a = 5;
- int b = 6;
- Console.WriteLine("a={0}; b={1}", a, b);
- if (add(a, b))
- {
- Console.WriteLine("a={0}", a);
- }
- else
- {
- Console.WriteLine("Pārpildīšanās kļūda");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement