Using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;
namespace zn { class Program { public static void Main(string[] args) { int sum = 0; int m = 1; Console.Write("Введите n > "); int n = Convert.ToInt32(Console.ReadLine()); for(int i=0; i<n; i++) { Console.Write("Введите число > "); int c = Convert.ToInt32(Console.ReadLine()); if (c.ToString().EndsWith("3") || c.ToString().EndsWith("4")) sum += c; if (c % 5 == 0 && c % 3 != 0) m *= c; } Console.WriteLine("Сумма чисел заканчивающихся на 3 или на 4: " + sum); Console.WriteLine("Произведение чисел, делящихся на 5, но не на 3: " + m); Console.ReadKey(); } } }
int main() { double A, B, C, D; cout << "Введите действительные числа A, B, C и D через пробел: "; cin >> A >> B >> C >> D; if (A<=B && B<=C && C<=D) { int max = A; if (B > max) max = B; if (C > max) max = C; if (D > max) max = D; A = max; B = max; C = max; D = max; } else if (!(A>B && B>C && C>D)) { A = A*A; B = B*B; C = C*C; D = D*D; } cout << "Результат: " << A << ' ' << B << ' ' << C << ' ' << D; return 0; }
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace zn
{
class Program
{
public static void Main(string[] args)
{
int sum = 0;
int m = 1;
Console.Write("Введите n > ");
int n = Convert.ToInt32(Console.ReadLine());
for(int i=0; i<n; i++)
{
Console.Write("Введите число > ");
int c = Convert.ToInt32(Console.ReadLine());
if (c.ToString().EndsWith("3") || c.ToString().EndsWith("4"))
sum += c;
if (c % 5 == 0 && c % 3 != 0)
m *= c;
}
Console.WriteLine("Сумма чисел заканчивающихся на 3 или на 4: " + sum);
Console.WriteLine("Произведение чисел, делящихся на 5, но не на 3: " + m);
Console.ReadKey();
}
}
}