Skip to content

Instantly share code, notes, and snippets.

static void Main(string[] args)
{
Console.Write("Enter the number of elements : ");
int n = int.Parse(Console.ReadLine());
int[] input = new int[n];
for (int i = 0; i < n; i++)
{
Console.Write("Enter the element N.{0} : " , i + 1);
input[i] = int.Parse(Console.ReadLine());
}
int sumMain = 0;
int sumSub = 0;
for (int row = 0; row < 2; row++)
{
for (int column = 0; column < 2; column++)
{
//row count = column count
if (row == column)
{
public static void Swap(int[] a , int firstIndex , int secondIndex)
{
var buffer = a[firstIndex];
a[firstIndex] = a[secondIndex];
a[secondIndex] = buffer;
}
public static void Sort(int[] a)
{
//Descending order
// CppTests.cpp : Defines the entry point for the console application.
//
//#include "stdafx.h"
#include <iostream>
#include <string>
#include <sstream>
#include <list>
#include <vector>
using namespace std;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DistinctYears
{
class Program
{
public static double[,] MultiplyMatrix(double[,] A , double[,] B)
{
int rA = A.GetLength(0);
int cA = A.GetLength(1);
int rB = B.GetLength(0);
int cB = B.GetLength(1);
double[,] final = new double[rA , cB];
if (cA != rB)
{
public static void Sort(int[] a)
{
//sorts from big to small
//(Descending)
for (int i = 0; i < a.Length; i++)
{
if (i < 0)
{
i = 0;
}
private void Button(object sender,EventArgs e)
{
int days = int.Parse(Textbox1.Text);
int a = 1;
double money = double.Parse(Textbox2.Text);
double cal;
lop:
if (a < days)
{
cal = (money * 2.1) / 100;
for (int i = 1; i <= 3; i++)
{
//print spaces first
for (int i2 = 0; i2 < (3 - i); i2++)
{
Console.Write(" ");
}
//print stars
for (int i3 = 0; i3 < (2 * i - 1); i3++)
Console.Write("Enter Lines count : ");
int linesCount = int.Parse(Console.ReadLine());
for (int i = 0; i < linesCount; i++)
{
//loop [linesCount] times, if linesCount = 3 then :
// * > 2 spaces,1 star
// *** > 1 space,3 stars
//***** > 0 space,5 stars
//space count = linesCount - i - 1
int spaceCount = linesCount - i - 1;