I managed to make this simple two part program which consists of simple print and scan functions. The first part is an addition operation and the second part asks the user for a letter and then it repeats it to the user. The first part goes well but when it finishes and is supposed to start the second part it shows the whole thing before I can input a letter.
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
int num1, num2 = 522;/*input a number*/ /*add 522*/
int sum; /*sum of num1 and num2*/
char let; /*Letter to put in*/
printf("Hello, my name is John Doe.\n"); /*Print "Hello my name is*/
printf("Please type a number= "); /*Ask user for num1*/
scanf("%d", &num1); /*Scan for num1*/
sum = num1 + 522; /*Add 522 to num1*/
printf("The sum of %d and %d is %d\n", num1, num2, sum);/*print num1 and sum*/
printf("Please type a letter= \n"); /*Ask user for letter*/
scanf("%c", &let); /*Scan for letter*/
printf("You typed %c\n", let); /*Show the letter input*/
return 0;
}