Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main( int argc, char **argv ) {
- double S, H, K;
- int A;
- char V;
- /* Operation sisestada S */
- printf("Raha summa = ");
- scanf("%lf", &S);
- V = '+';
- while( S > 0 && V == '+' ) {
- printf ("Kauba artikkel = ");
- scanf("%d", &A);
- do {
- printf("Kauba hind (positiivne) = ");
- scanf("%lf", &H);
- } while( H < 0 );
- do {
- printf("Kauba kogus (positiivne) = ");
- scanf("%lf", &K);
- } while( K < 0 );
- if( H * K <= S ) {
- S -= H * K;
- printf("Kaup on ostetud. Teil jäi %8.2lf EEK.\n", S);
- } else {
- printf("Raha jäi puudu.\n");
- }
- printf("Kas soovite jätkata? '+' või '-' ");
- scanf("%c", &V);
- }
- printf("Külastage meid jälle!");
- //scanf("%c",&V);
- //scanf("%c",&V);
- return 0;
- }
Add Comment
Please, Sign In to add comment