Skip to content

C-Program 30

WRITE A PROGRAM to multiply two numbers using pointers.

#include <stdio.h>
 
int main()
{
// Declare 2 numbers
    int num1, num2;
    int    mul;
// Declare 2 integer pointers
    int *ptr1, *ptr2;
 
// Assign numbers address to pointers
    ptr1 = &num1; 
    ptr2 = &num2; 
 
    printf("Please enter two numbers for Multiplication: ");
    scanf("%d%d", ptr1, ptr2);
 
    mul = *ptr1 * *ptr2;
 
    printf("The Multiplication Results are = %d", mul);
 
    return 0;
}

Output