Linked Questions

5 votes
2 answers
13k views

In line 5 I read an integer and isint is getting 1 if it reads an integer or 0 if it's not an integer. If isint is 0 I have a loop asking user to give an integer and I read until the user gives an ...
Dchris's user avatar
  • 3,177
1 vote
2 answers
50k views

There are two different spots where the check happens. That is, where you enter a, s, m, d, or q and when you enter the first and second number. At any of the checks, if the check is false, it ...
King Sutter's user avatar
2 votes
5 answers
2k views

#include<stdio.h> #include<ctype.h> int main() { int number, sum = 0; // loop body is executed at least once do { printf("Enter a number: "); scanf("%d", &...
rohit raj's user avatar
0 votes
2 answers
4k views

I am trying to see if user enters 3 correct input. If not the loop ask for input again and again until they correct it correctly. #include <stdio.h> int main(void) { int num1,num2; ...
Aamir John's user avatar
0 votes
1 answer
3k views

In the example below, if I enter a character in Mac OS X terminal, the program will get stuck in an infinite loop, printing Please enter a number: line after line and never allowing the user to input ...
ilgaar's user avatar
  • 844
0 votes
1 answer
1k views

I have been struggling to figure out a way to enhance the error checking in my simple menu driven C code shown below. The code works fine with the right inputs, but unfortunately it goes in an ...
Ben Williams's user avatar
-1 votes
3 answers
1k views

I'm trying to write a C program that computes X^Y (X to the Y power) without using the 'pow' function. The program works fine when I enter numbers, but I'm having an issue with the code not stopping ...
Rozay's user avatar
  • 11
3 votes
3 answers
581 views

I am writing a program in CodeBlocks in C. I want to check if the input is in the right type and if not try to get it again. My problem is whenever I'm trying to get the input with scanf and the ...
uri2563's user avatar
  • 63
0 votes
1 answer
1k views

I've been writing a program that takes an input and checks if the number is even or odd and outputs an error message if the input is a character not a number my initial code was: int main() { int ...
NerdyKoala's user avatar
0 votes
1 answer
724 views

i have a function that ask to the user to enter a value to calculate its square root, however when i try to validate that the number of the input must be a number and not a char, it makes an infinite ...
Kleiver Marcano's user avatar
-5 votes
1 answer
871 views

Here is a program that "works", but will go into an infinite loop if character data "a" is entered or "-8" is entered. Here is the expected output when data is entered into the program: ****Input (...
Johnny311's user avatar
0 votes
3 answers
380 views

I had this problem before but went around it using other operator. But the same operator can't be used here I think (the getche();). Anyway this works well and good but if I input a letter it goes ...
user3052741's user avatar
-2 votes
1 answer
595 views

I wrote this code, and all it meant to do is input ints until a negative is entered: int result = 0, input_number = 0; while(input_number >= 0){ printf("Please enter students IDs(negetive to ...
Tal Mishaan's user avatar
0 votes
1 answer
349 views

I am trying to write a simple c program that takes input using scanf, and ensures that this input is an integer. To do this I have written a recursive function, but the function goes into an infinite ...
Harry Albert's user avatar
1 vote
0 answers
351 views

I tried to use the return value of the scanf function in a for-loop #include<stdio.h> int main(){ int a, b, c; for(a = 0; a < 10; ++a){ c = scanf("%d", &b); if(c != 1) ...
user8115665's user avatar

15 30 50 per page
1
2 3 4 5 6