#include<stdio.h>
int main(void){
int character;
double balance,amount;
printf("Enter the balance: ");
scanf("%lf",&balance);
printf("Enter the transaction type: ");
character = getchar();
if(character == 'w' || character =='W'){
printf("\nYou have selected to withdraw money");
printf("\nEnter the amount: ");
scanf("%lf",&amount);
balance -=amount;
printf("\nnew balalnce:%lf ",balance);
}else if(character == 'd' || character =='D'){
printf("\nYou have selected to deposit money");
scanf("%lf",&amount);
balance +=amount;
printf("\nnew balalnce:%lf ",balance);
}
return 0;
}
why getchar() doesn't read the input?
45 views Asked by Hasindu Dahanayake At
0
There are 0 answers
Related Questions in C
- How to call a C language function from x86 assembly code?
- What does: "char *argv[]" mean?
- User input sanitization program, which takes a specific amount of arguments and passes the execution to a bash script
- How to crop a BMP image in half using C
- How can I get the difference in minutes between two dates and hours?
- Why will this code compile although it defines two variables with the same name?
- Compiling eBPF program in Docker fails due to missing '__u64' type
- Why can't I use the file pointer after the first read attempt fails?
- #include Header files in C with definition too
- OpenCV2 on CLion
- What is causing the store latency in this program?
- How to refer to the filepath of test data in test sourcecode?
- 9 Digit Addresses in Hexadecimal System in MacOS
- My server TCP doesn't receive messages from the client in C
- Printing the characters obtained from the array s using printf?
Related Questions in INPUT
- Player input not working properly in unity
- Getting data attributes from HTML input element with a datalist
- how to find sum of input value in javascript
- Terminal stimulation
- C#: creating an array and appending console input to each value
- How do i make a text inside disabled <v-text-field> selectable (simply to copy and paste somewhere else)?
- C++ File Input Skipping Lines
- React text box not taking input
- Trying to build a Generative Adversarial Network to generate images based on captions but facing errors with input shapes
- Video controls are hidden behind input feature?
- How can I edit a todo list on the same input where add todo in React?
- Stopping code while the input line is running
- Store Gum Input in variable?
- Detect password manager (or chromium) autofill for websites
- How can I make sure that my Selector does not overlap my text-area box when hover ? I would like for the selector to smoothly push down the text-area
Related Questions in GETCHAR
- Does getchar read ctrl+z or return EOF?
- getchar is able to read ctrl+z but not scanf?
- Why does getchar in C accept many characters in a loop but not outside one
- Does a character have to be casted to unsigned char before being compared to getc family returns?
- why getchar() doesn't read the input?
- what is the use of getchar() in following program
- Why am I doing wrong with getchar()? (initializer element is not constant)
- Why does while((c = getchar()) != EOF) repeat 2 times in c programming?
- getchar() prompting for input when typing space before Enter
- Loop skips over getchar in C?
- Problem with reading/writing on the terminal line
- Why does my 'do while' loop first asks for getchar before executing printf?
- scanf() and getchar() working differently
- C switch, how to fix multiple default prints?
- The use of EOF (Ctrl + D) in getchar() in C
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)