#include <stdio.h>
#include <conio.h>
int main(void)
{
int num1;
int num2;
int sum;
printf("Enter your first number: ");
scanf("%d", &num1);
printf("Enter your second number: ");
scanf("%d", &num2);
sum = num1 + num2;
printf("The sum is %d", sum);
getch();
}
ok I got 2 questions,
first the program runs fine with/without #include <conio.h>
why and when do I have to include it?
second scanf ("%d", &num1); and printf("The sum is %d", sum);
why do I use & on scanf, but not printf?
when i put & in printf it gives me The sum is 2686780. why?
Thanks ;)
p.s. sorry for my poor english, but I promise you I'll get better :)
Edited by dargueta, 26 November 2010 - 02:10 PM.
Changed quote tags to code


Sign In
Create Account

Back to top









