UPDATE scanf("%c ", &code); ==> scanf(" %c", &code); was the solution but i do not understand why
Hello, I have followed the format specifier rules and I tried to experiment with it but I still have the same problem it does not allow me to input MESSAGE= try to run this code written in C and you will see,
you can input any number tho. NUM = 5 population = 12345 the code part is a letter (%c) and message is a word atleast (%s)
thanks
#include <stdio.h>
int main(){
//Declare and initialize variables
int num;
float amt;
double pi;
long int pop_ph;
char code;
char msg[90];
printf("\n Enter the value of num: ");
scanf("%d", &num);
printf("\n Enter the value of amt: ");
scanf("%f", &amt);
printf("\n Enter the value of pi: ");
scanf("%e", &pi);
printf("\n Enter the population of Ph: ");
scanf("%ld", &pop_ph);
printf("\n Enter the value of code: ");
scanf(" %c", &code);
printf("\n Enter the message: ");
scanf("%s", msg);
printf("\n\n NUM = %d \n AMT = %f \n PI = %e \n POPULATION OF PH = %ld \n CODE = %c \n MESSAGE = %s", num, amt, pi, pop_ph, code, msg);
return 0;
}