Search
 
SCRIPT & CODE EXAMPLE
 

C

ask the user if they would like to do something again in C

#include<stdio.h>
int main(){
int x, y, sum;
char ch;
print:
    printf ("Enter the first number:");
    scanf ("%d",&x);
    printf ("Enter the second number:");
    scanf ("%d",&y);
    sum=x+y;
    printf ("
The total number is:%d
",sum);
again:
    printf ("
					Do you want to repeat the operation(Y/N): ");
    scanf (" %c", &ch);

    if(ch == 'y' || ch == 'Y'){
        goto print;
    }
    else if(ch == 'n' || ch == 'N'){
        return 0;
    }
    else{
        printf("
					Please enter Yes or NO.
");
        goto again;
    }
   return 0;
Comment

PREVIOUS NEXT
Code Example
C :: rand in c 
C ::  
::  
C :: phpunit assert continue 
:: Uri/Beecrowd problem no - 1151 solution in C 
C :: abs() for floting point in C 
C :: worst fit program in c 
C ::  
C :: arma 3 key pressed 
C :: C Change Value of Array elements 
C ::  
:: gnunet 
C ::  
::  
C ::  
C :: deepak rake 
:: Print fabionci with fork in C 
C ::  
::  
C :: navigate to line intellij 
C ::  
:: printf("%d", 10 ? 0 ? 5:1:1:12) what will print 
::  
Dart :: python read json from url 
Dart ::  
Dart :: dart round to 2 decimals 
Dart :: flutter return empty widget 
:: flutter absorbpointer 
Dart :: Round button with text and icon in flutter 
Dart :: generate method o dart list 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =