Input/Output in Programming Languages

This section explores the syntax and methods used for I/O in multiple programming languages.

Code (Terminal Input Value)

        
#include <stdio.h>
int main() {
    int num1, num2, result;
    printf("Enter first number: ");
    scanf("%d", &num1);
    printf("Enter second number: ");
    scanf("%d", &num2);
    result = num1 * num2;
    printf("Multiplication result: %d\n", result);
    return 0;
}
      

Output

Enter first number : 5
Enter second number : 4
Multiplication result : 20
      

Code (Direct Assign Value)

        
        #include 

            int main() {
                int num1 = 5;  // Directly assigned value
                int num2 = 4; // Directly assigned value
                int result;
                
                result = num1 * num2;
                printf("First no is : %d\n", num1)
                printf("Second no is : %d\n", num2)
                printf("Multiplication result: %d\n", result);
                return 0;
                }     

Output

First no is : 5
Second no is : 4
Multiplication result : 20