Posts

Showing posts with the label goto

Goto Break and Continue Statement in C

Image
Goto Statement : The goto statement is used to alter the normal sequence of program execution by transferring control to some other part of the program unconditionally. Syntax : goto label; where the label is an identifier that is used to label the target statement to which the control is transferred. Control may be transferred to anywhere within the current function. The target statement must be labeled, and a colon must follow the label. Thus the target statement will appear as label:statement; Each labeled statement within the function must have a unique label, i.e., no two statement can have the same label. C – GOTO STATEMENT EXAMPLE PROGRAM : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 #include<stdio.h> #include<conio.h> void main () { int   number ; clrscr (); printf ( “ www . ” ); goto x ; y : printf ( “.com” ); goto z ; x : printf ( “c prog

a demo program which represent the ATM transaction

ATM programing ATM C programing language Program code  ‎/*Note Pin code is 1234*/ #include<stdio.h> #include<conio.h> void main(void) { unsigned long amount=1000,deposit,withdr​aw; int choice,pin=0,k=0; char another='y'; while(pin!=1234) { clrscr(); gotoxy(30,25); printf("Enter pin:"); scanf("%d",&pin); } clrscr(); do { printf("********Welcome to ATM Service**************\n"); printf("1. Check Balance\n"); printf("2. Withdraw Cash\n"); printf("3. Deposit Cash\n"); printf("4. Quit\n"); printf("******************​**************************​*\n\n"); printf("Enter your choice: "); scanf("%d",&choice); switch(choice) { case 1: printf("\nYour Balance is Rs : %lu ",amount); break; case 2: printf("\nEnter the amount to withdraw: "); scanf("%lu",&withdraw); if(withdraw%100!=0) { printf("\