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