Write a program that displays "hello" 10 times. Using the For-loop.
******** In Algorithm ********
Algorithm
Variables i: integer
Begin
for i from 1 to 10
write("Hello")
next
End
Result : ==> Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello
******** In C ********
#include <stdio.h> int main(){ int i , S=0 ,N; for (i= 0; i < 10 ; i++ ) { printf("Hello\n"); } return 0; }
******** In C++ ********
#include <iostream>
using namespace std;
int main(){
int i , S=0 ,N;
for (i= 0; i < 10 ; i++ ) {
cout<<"Hello"<<endl;
}
return 0;
}
******** in Python ********
******** in Python ********
for i in range(10) :
print("hello")
******** in JAVA ********
import java.util.Scanner;
class Main {
public static void main(String[] args){
int i;
for(i=0;i<10;i++) {
System.out.print("hello \n");
}
}
}
********* in C# *******
using System;
public class Ex16 {
public static void Main(string[] args)
{ int i;
for (i= 0; i < 10 ; i++ )
Console.WriteLine("hello");
}
}
class Main {
public static void main(String[] args){
int i;
for(i=0;i<10;i++) {
System.out.print("hello \n");
}
}
}
using System;
public class Ex16 {
public static void Main(string[] args)
{ int i;
for (i= 0; i < 10 ; i++ )
Console.WriteLine("hello");
}
}