This is my program.
It does some really crazy things. The output I get on part c is something like -854892179.It does some really crazy things. The output I get on part c is something like -854892179.Code:
#include <stdio.h>
int main ()
{
int num1, num2;
int num3;
char letter;
/* part a */
scanf("%d", &num1);
scanf("%d",&num2);
printf("%d\n", num1/num2);
printf("%d\n", num1 % num2);
printf("%.2f\n", (float)num1/num2);
/* part b */
scanf("%c", &letter);
printf("%d\n", letter);
printf("%c\n", letter+32);
/* part c */
scanf("\n %d", &num3);
printf("%d\n", num3);
}
Just input something like "3" "2" "a" and watch it all go to heck.
and when I look at debugger windows I see "letter" contains a newline, but I can't figure out why. Would appreciate your help.