#include <cctype> #include <algorithm> #include <cmath>#include <iomanip> #include <windows.h>#include <conio.h>#include <set>#include <iostream> #include <string> #include <vector> using namespace std;
int main(){ int a, b,f=0,f1=0,ans=0; cin >> a >> b; if (a < 0 ) f = 1; if (b < 0) f1 = 1; for (int i = 0; i < abs(b);i++) { ans += a; } if (f == 1 && f1 == 1) cout << abs(ans); else if (f == 1 || f1 == 1) cout << '-' << abs(ans); else cout << ans; return 0;}
Using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace Dcoder
{
public class Program
{
public static void Main(string[] args)
{
Console.Write("Размер массива: ");
int n = Convert.ToInt32(Console.ReadLine());
int[] arr = new int[n];
Random rand = new Random();
for (int i = 0; i < arr.Length; i++)
arr[i] = rand.Next(1, 100);
for (int i = 0; i < arr.Length; i++)
if (arr[i] % 2 == 0)
Console.WriteLine(arr[i]);
Console.WriteLine();
for (int i = 0; i < arr.Length; i++)
if (arr[i] % 2 != 0)
Console.WriteLine(arr[i]);
Console.ReadLine();
}
}
}
Uses crt;
const n=12;
var m:array[1..n] of integer;
k,s,i:integer;
begin
randomize;
for i:=1 to n do
begin
m[i]:=random(9)+1;
writeln(m[i]);
if m[i] mod 2<>0 then begin inc(k); s:=s+m[i]; end;
end;
writeln;
writeln(k);
writeln(s);
end.