If else else If Statement in C in Hindi

If else Statement in C in Hindi – Else If Ladder Statement in Hindi इसमें इनके बारे में पूरी तरह से जानेगे। वैसे हमने Decision Making in C in Hindi Article में If else Statement की जानकारी share की थी। लेकिन इन Article में हम इनको बहुत अच्छे से जानेगे। इसके Program भी बनायेगे। If else की Tricks Question भी देखेंगे।
If else Statement in C in Hindi
If else statement के द्वारा Program में Condition Create कर सकते है और Condition के True या False में अलग अलग Task Run करा सकते है।
- मान लो एक Program बनाया जैसे – Game Application Condition है। अगर User की Age 18+ है, तभी Game Run होगा नहीं तो Game Run नहीं होगा। तो इसमें Condition लगी है, और ये Process तभी होगी जब कोई Age Enter करेगा।
- मान लो एक Password Enter और Password Re – Enter का Input ले रहा है, तो इसमें भी Condition लगी होगी। अगर password first input से Second Input में Match हो रहा है। तभी आगे की Process Run होगी नहीं तो Error Show करेगा।
- Programming में Condition की आवश्यकता बहुत जगह पड़ती है। ये दो If else statement Decision Making के Simple उदाहरण है, ऐसी ही बड़ी – बड़ी Condition इसके द्वारा Create की जाती है।
Types of If else Statement in Hindi
अब हम जानेगे If else Statement कितने प्रकार के होते है। If else Statement 4 प्रकार के होते है।
- If Statement
- If else Statement
- If else if Ladder Statement
- Nested If Statement
If Statement in Hindi
If Statement Single Condition पे Work करता है। अगर Condition true होगी तो If Statement का Block Execute होगा।
Syntax of If statement in Hindi
if (condition) { //code to be Executed }
ये इसका Syntax है।
Example Of If Statement in Hindi
#include<stdio.h> int main() { int age = 20; if(18<age) { printf("You are eligibe for Voting"); } }
Output
You are eligibe for Voting
If else Statement in Hindi
if(condition) { //code to be executed } else { code to be executed }
Example of If else Statement in Hindi
#include <stdio.h> int main() { int age = 22; if(18<age) { printf("You are eligible for voting"); } else { printf("You are not eligible for voting"); } return 0; }
Output
You are eligible for voting
Example 2 of If else statement in Hindi
#include <stdio.h> int main() { int age = 17; if(18<age) { printf("You are eligible for voting"); } else { printf("You are not eligible for voting"); } return 0; }
Output
You are not eligible for voting
else if Ladder Statement in C in Hindi
if (condition) { //code to be executed } else if (condition) { //code to be executed } else if (condition) { //code to be executed } else { //code to be executed }
else if Ladder Statement Example in Hindi
#include <stdio.h> #include <conio.h> int main() { int a = 5; int b = 6; int c = 8; if(a>b&&a>c) { printf("Greater Value %d",a); } else if (b>a&&b>c) { printf("Greater Value %d", b); } else { printf("Greater Value %d", c); } getch(); return 0; }
Output
Greater Value 8
Nested If Statement in Hindi
if (condition) { // Executes when condition1 is true if (condition1) { // Executes when condition2 is true } if (condition2) { // Executes when condition2 is true } }
Nested If Statement Example in Hindi
#include <stdio.h> int main() { int n = 20; if (n == 20) { if (n < 25) { printf("n is smaller than 25n"); } if (n < 21) { printf("n is smaller than 21 toon"); } else { printf("n is greater than 25"); } } return 0; }
Output
n is smaller than 25 n is smaller than 21 too