This is sensible question. You may not understand the purpose of this question until you compile and run. However, I strongly recommend you to trace the output for your input and check your result with original result by running it in your computer.
#include <stdio.h>
int main()
{
int a, b, c;
printf("\nenter a: ");
scanf("%d", &a);
printf("enter b: ");
scanf("%d", &b);
c = a+ b;
char ch;
printf("enter character") ;
scanf("%c", &ch);
printf("\nthe entered character is: %c", ch);
return 0;
}
Explanation: how to read mix of integers and characters
#include <stdio.h>
int main()
{
int a, b, c;
printf("\nenter a: ");
scanf("%d", &a);
printf("enter b: ");
scanf("%d", &b);
c = a+ b;
char ch;
printf("enter character") ;
scanf("%c", &ch);
printf("\nthe entered character is: %c", ch);
return 0;
}
Explanation: how to read mix of integers and characters
No comments:
Post a Comment