Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Assignment 7
/* Write a complete C program that first requests and reads two positive integers. The program should then continue to read integers, one at a time, as long as the sum total of all input integers is less than 17 and no greater than 21. Once the program has finished reading, it should print either the total, if it is 21 or less, or the words "I lose" if the total is over 21. You may assume that the range of integers entered by the user is between 1 and 11 (inclusive). Here is an example output of the C program: First number? 5 Second number? 1 The total: 6 First number? 10 Second number? 5 The total: 15 Etc. Here is another example: First number? 11 Second number? 11 I lose 1. Write a pseudocode for your program. 2. Write a C program that implements your algorithm. 3. Test your program using the following test cases: a. Check for negative numbers b. Check for non-digit numbers. // DEFINE ARRAY OF VARIABLE SIGN //add one to the variable each time you are done scanning */ #include <stdio.h> int main(){ int n; int array[n]; int totalSum=0; int i=0; for (i=0; i<2; i++){ scanf("%d", &array[i]); printf("The numbers entered are %d\n", array[i]); totalSum+=array[i]; } } /****** printf("totalSum so far is %d", totalSum); if (totalSum<21){ if(totalSum<17){ ++n; } else{ printf("your total is %d and you win", totalSum); else{ printf("totalSum so far is %d and over 21 so you lose!", totalSum); } } i=0; do(array[i] sum+=array[i]; i++; }while ( */
run
|
edit
|
history
|
help
0
Exm
ImprimeMensaje.c
lab2
pseudo hw v.05
PREGUNTA 3 - MODULO 4 TERMINADA
MatrixMul_shortxshort
Test2
Incometax problem v0.1
palindrome.c
llist.h