this c program is giving garbage value . Can anyone help me find the mistake | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

this c program is giving garbage value . Can anyone help me find the mistake

#include <stdio.h> int main(){ int num1,num2,num3; printf("Enter three Interger Numbers and i will give you the smallest value.\n"); printf("Enter fisrt value : "); scanf("%d",&num1); printf("\nEnter Second value : "); scanf("%d",&num2); printf("\nEnter Third Value : "); scanf("%d",&num3); if(num1<num2 && num1<num3){ printf("\n%d is the smallest number",&num1); } if(num2<num1 && num2<num3) { printf("\n%d is the smallest number",&num2); } { if(num3<num2 && num3<num1) printf("\n%d is the smallest number",&num3); } return 0; }

26th Dec 2018, 11:57 AM
Abdul Bari Abbasi
Abdul Bari Abbasi - avatar
3 Answers
+ 3
Dont use &num1, but directly num1 Continue it to 3
26th Dec 2018, 12:05 PM
ShortCode
+ 2
printf(%d, num1)
26th Dec 2018, 12:05 PM
ShortCode
+ 1
thanks guys!
26th Dec 2018, 12:26 PM
Abdul Bari Abbasi
Abdul Bari Abbasi - avatar