Присвоение определенного числа, деление и вывод - C#
Формулировка задачи:
Здраствуйте. Кто может помочь ? Имеется код в нем нужно каждому fanc присвоить определенного число,поделить 1 на 2-е и вывести результат на экран .
Листинг программы
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication2
- {
- class Program
- {
- static int myfanc (int h, int l)
- {int s =0;
- h = h + 20;
- return s;
- }
- static int fanc2(ref int o)
- {
- int s = 0;
- o = o + 20;
- return s;
- }
- static void Main(string[] args)
- {
- int he = 5;
- int u = 5;
- myfanc(he, u);
- fanc2(ref u);
- Console.WriteLine("U={0};", u);
- Console.WriteLine("he={0};", he);
- Console.ReadKey();
- }
- }
- }
Решение задачи: «Присвоение определенного числа, деление и вывод»
textual
Листинг программы
- static int myfanc(int h, int l)
- {
- int s = 0;
- s = h + l;
- return s;
- }
- static int fanc2(ref int o)
- {
- int s = 0;
- s = o + 20;
- return s;
- }
- static void Main(string[] args)
- {
- int he = 5;
- int u = 5;
- int s1 = myfanc(he, u);
- int s2 = fanc2(ref u);
- Console.WriteLine("u={0};", u);
- Console.WriteLine("he={0};", he);
- Console.WriteLine("s1={0};", s1);
- Console.WriteLine("s2={0};", s2);
- Console.WriteLine("s1/s2={0};", (double)s1/s2);
- Console.ReadKey();
- }
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д