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