Hello Friends i m Deepak Saini. Today i m trying to explain how to use the Goto And Exit keyword in C.
JAI HIND
JAI BHARAT
Love To :- My Father,My Mother, Govind Singh , DeadManINDIA,Sumit Dagar .
SO Lets start :-
Goto Keyword :- We are using goto keyword to jump the program to a switch or function.In my case i explain switch .
Exit function :- We are using exit function for terminate the execution of a program.We are passing vaule one in this case when we are go for terminate the program execution.
Lets take a example :-
#include<stdio.h>
#include<stdlib.h>
int main()
{
int a;
printf("Enter the No =");
scanf("%d",&a);
if ( a <= 10 )
goto D;
else
{
printf("Enter this no =%d",a);
exit (1);
}
D:
printf("I am Deepak Saini" );
return 0;
}
Output
Enter the no = 5
I am Deepak saini
Or
Enter the no = 11
Enter this no = 11
Thats all gone when u execute this program .
In this program all things are use same we are use If condition or Goto Or exit (1)
We are use if condition for check input if condition true then execute our Goto keyword and we jump on switch D if condition is not true the our program print the else condition.And print the enterd no in this program and we are using the exit(1) for terminate the program.
THanks for reading if any mistake the comment we try to correct that and give u feed back.
JAI HIND
JAI BHARAT
JAI HIND
JAI BHARAT
Love To :- My Father,My Mother, Govind Singh , DeadManINDIA,Sumit Dagar .
SO Lets start :-
Goto Keyword :- We are using goto keyword to jump the program to a switch or function.In my case i explain switch .
Exit function :- We are using exit function for terminate the execution of a program.We are passing vaule one in this case when we are go for terminate the program execution.
Lets take a example :-
#include<stdio.h>
#include<stdlib.h>
int main()
{
int a;
printf("Enter the No =");
scanf("%d",&a);
if ( a <= 10 )
goto D;
else
{
printf("Enter this no =%d",a);
exit (1);
}
D:
printf("I am Deepak Saini" );
return 0;
}
Output
Enter the no = 5
I am Deepak saini
Or
Enter the no = 11
Enter this no = 11
Thats all gone when u execute this program .
In this program all things are use same we are use If condition or Goto Or exit (1)
We are use if condition for check input if condition true then execute our Goto keyword and we jump on switch D if condition is not true the our program print the else condition.And print the enterd no in this program and we are using the exit(1) for terminate the program.
THanks for reading if any mistake the comment we try to correct that and give u feed back.
JAI HIND
JAI BHARAT
0 comments:
Post a Comment