C Program
| #include<stdio.h> |
| |
| int main() { |
| int a,b,max; |
| |
| printf("Enter any two numbers: "); |
| scanf("%d%d",&a,&b); |
| |
| if(a > b) { |
| max = a; |
| } else { |
| max = b; |
| } |
| |
| printf("Max = %d",max); |
| } |
C++ Program
| #include<iostream> |
| using namespace std; |
| int main() { |
| int a,b; |
| |
| cout << "Enter any two numbers: "; |
| cin >> a >> b; |
| |
| int max; |
| |
| if (a > b) { |
| max = a; |
| } else { |
| max = b; |
| } |
| |
| cout << "Max = " << max << endl; |
| return 0; |
| } |
| import java.util.Scanner; |
| class Max2 { |
| public static void main(String args[]) { |
| int a,b; |
| |
| Scanner sc = new Scanner(System.in); |
| System.out.print("Enter any two numbers: "); |
| a = sc.nextInt(); |
| b = sc.nextInt(); |
| |
| int max; |
| if(a > b) { |
| max = a; |
| } else { |
| max = b; |
| } |
| |
| System.out.println("Max = "+max); |
| } |
| } |
| package main |
| |
| import "fmt" |
| |
| func main() { |
| var a,b int |
| |
| fmt.Print("Enter any two numbers: ") |
| fmt.Scan(&a,&b) |
| |
| var max int |
| |
| if a > b { |
| max = a |
| } else { |
| max = b |
| } |
| |
| fmt.Println("Max = ",max) |
| } |
| if(isset($_POST['sub'])) { |
| $a = $_POST['a']; |
| $b = $_POST['b']; |
| |
| if($a > $b) { |
| $max = $a; |
| } else { |
| $max = $b; |
| } |
| |
| echo "Max = ".$max; |
| } |
Comments