using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace p16_functii
{
class Program
{
static void schimba(int a, int b)//prin valoare
{
int aux = a; a = b; b = aux;
}
static void inter(ref int a, ref int b)//prin referinta
{
int aux = a; a = b; b = aux;
}
static void cifre(int n, out int sc, out int nc)//param de iesire
{//suma si numarul de cifre
sc = nc = 0;
while (n != 0)
{
sc = sc + n % 10;
nc++;
n = n / 10;
}
}
static void Main(string[] args)
{
int a = 234, b = 4;
schimba(a, b);
Console.WriteLine(a + " " + b);
inter(ref a, ref b);
Console.WriteLine(a + " " + b);
cifre(234523, out a, out b);
Console.WriteLine(a + " " + b);
Console.ReadKey();
}
}
}
|