Skip to content

Instantly share code, notes, and snippets.

@MeetMartin
Created October 29, 2020 20:42
Show Gist options
  • Select an option

  • Save MeetMartin/8dc267337cfa33e7c100eb369ce4987f to your computer and use it in GitHub Desktop.

Select an option

Save MeetMartin/8dc267337cfa33e7c100eb369ce4987f to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main()
{
int num1, num2, num3;
int *p1, *p2, *p3;
//taking input from user
printf("Enter First Number: ");
scanf("%d",&num1);
printf("Enter Second Number: ");
scanf("%d",&num2);
printf("Enter Third Number: ");
scanf("%d",&num3);
//assigning the address of input numbers to pointers
p1 = &num1;
p2 = &num2;
p3 = &num3;
if(*p1 > *p2) {
if(*p1 > *p3){
printf("%d is the largest number", *p1);
}else{
printf("%d is the largest number", *p3);
}
}else{
if(*p2 > *p3){
printf("%d is the largest number", *p2);
}else{
printf("%d is the largest number", *p3);
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment