For1. Даны целые числа K и N (N > 0). Вывести N раз число K.
Решение Python
1 2 3 4 5 6 7 8 9 | # Input integers K and N K = int(input("Enter the value of K: ")) N = int(input("Enter the value of N: ")) # Calculate N times K result = N * K # Output the result print(f"{N} times {K} is: {result}") |
>
Решение Pascal
1 2 3 4 5 6 7 8 9 10 | program For1; var K,N, i:Integer; begin Write('Введите N: '); Readln(N); Write('Введите K: '); Readln(K); For i:=1 to N do Writeln(K); end. |
>
Решение C
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #include int main(void) { int k, n; printf("K: "); scanf ("%i", &k); printf("N: "); scanf ("%i", &n); int i; for (i = 0; i<n; ++i) printf("%i",k); return 0; } |
Решение C++
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #include <iostream> using namespace std; int main() { int k, n; cout << "K:"; cin >> k; cout << "N:"; cin >> n; int i; for (i = 0; i < n; ++i) cout << k << endl; return 0; } |
Решение C#
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | using System; namespace ConsoleApp { class Program { static void Main(string[] args) { int K, N; Console.Write("K:"); K = Convert.ToInt32(Console.ReadLine()); Console.Write("N:"); N = Convert.ToInt32(Console.ReadLine()); for (int i = 0; i < N; i++) Console.WriteLine(K); Console.ReadKey(); } } } |
>
Решение Java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | package abramyan; import java.util.Scanner; public class Abramyan { public static void main(String[] args) { int K, N; Scanner in = new Scanner(System.in); System.out.print("K:"); K = in.nextInt(); System.out.print("N:"); N = in.nextInt(); for (int i = 0; i < N; i++) System.out.println(K); in.close(); } } |
как решить задачу на с++?
Решение на С++ добавлено!
на языке Питон
n=int(input(‘n=?’))
k=int(input(‘k=?’))
for i in range (0,n):
print(k)
можете ответить , почему использовано range (0,n) ??
Как решать задачу на VBA
как решить задачу на Python?
Как решать задачу на VBA
n=int(input())
k=int(input())
i=0
for i in range(k):
i+=1
print(n)
fun main (args: Array) {
var k: Int = readLine()!!.toInt()
var n: Int = readLine()!!.toInt()
for (i in 1..n ) {
println(k)
}
}
fun main() {
var K = 10
var N = 3
for (anyname in 1..N){
println(K)
}
}
чтоб одамо нагзтар фахмад 😀
\\На языке котлин
fun main() {
var K = 10
var N = 3
for (anyname in 1..N){
println(K)
}
}
как решить на паскаль через while?
На языке Swift
let K = 10
let N = 3
for _ in 1…N{
print(K)
}
na Javascript?
let K = 21,
N = 7;
for (let i=0; i < N; i++) {
console.log(K);
}
Scanner sc = new Scanner(System.in);
int k = sc.nextInt();
int n = sc.nextInt();
for (int i = 0; i<n; i++){
System.out.print(k+" ");
}