******** In Algorithm ********
Algorithm Variables note : real Begin write(" Enter note : ") read (note) if(note < 0 or note > 20) then write("Error !!" ) next
if( note >= 0 and note < 10) then write(" not validated" ) next
if( note >= 10 and note <= 20) then Ecrire("validated" )
next
End
Result ==> Enter note : 12.5 Validated
******** In C ********
#include <stdio.h> int main() { float note ; printf(" Enter note : "); scanf("%f",¬e); if ( note < 0 || note > 20) printf("Error !!" ); if ( note >= 0 && note < 10) printf(" not validated" ); if ( note >= 10 && note <= 20) printf("validated" ); return 0; }
******** In C++ ********
#include <iostream>
using namespace std;
int main() {
float note ;
cout<<" Enter note: ";
cin>> note;
if ( note < 0 || note > 20)
cout<<"Error !!" ;
if ( note >= 0 && note < 10)
cout<<" not validated" ;
if ( note >= 10 && note <= 20)
cout<<" validated";
return 0;
}
******** in Python ********
******** in Python ********
note = float(input("Enter note:"))
if note <= 20 and note >= 10 :
print("Validated")
elif note < 10 and note >= 0 :
print("not Validated ")
else :
print("Error !!! ")
******** En JAVA ********
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner (System.in);
System.out.print("Enter note :");
int note = sc.nextInt();
if ( note < 0 || note > 20)
System.out.print("Error !!");
if ( note >= 0 && note < 10)
System.out.print("not validated");
if ( note >= 10 && note <= 20)
System.out.print("Validated");
}
}
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner (System.in);
System.out.print("Enter note :");
int note = sc.nextInt();
if ( note < 0 || note > 20)
System.out.print("Error !!");
if ( note >= 0 && note < 10)
System.out.print("not validated");
if ( note >= 10 && note <= 20)
System.out.print("Validated");
}
}
********* En C# *******
using System;
public class Ex6 {
public static void Main(string[] args)
{ float N;
Console.Write("Enter N:");
N=float.Parse(System.Console.ReadLine());
if (N>20 || N<0 )
Console.WriteLine ("Error!! ");
if (N <= 20 & N >=10)
Console.WriteLine ("Validated");
if (N <= 10 & N >=0)
Console.WriteLine ("Not Validated");
}
}
using System;
public class Ex6 {
public static void Main(string[] args)
{ float N;
Console.Write("Enter N:");
N=float.Parse(System.Console.ReadLine());
if (N>20 || N<0 )
Console.WriteLine ("Error!! ");
if (N <= 20 & N >=10)
Console.WriteLine ("Validated");
if (N <= 10 & N >=0)
Console.WriteLine ("Not Validated");
}
}