Program to find greatest of two numbers in c in Hindi.

Program to find greatest of two numbers in c in hindi

दी गई दो संख्याओं में से सबसे बड़ी संख्या ज्ञात करने के लिए C प्रोग्राम की चर्चा यहाँ की गई है। उपयोगकर्ता से दो पूर्णांक इनपुट करें और उनमें से सबसे बड़ी संख्या पाएं। दो संख्याएँ num1 और num2 दिए गए हैं। कार्य दोनों में से सबसे बड़ी संख्या ज्ञात करना है।

Example:-

Input: num1 = 2, num1 = 8
Output: Largest number = 8
Input: num1 = 20, num1 = 18
Output: Largest number = 20
  1. उपयोगकर्ता से दो पूर्णांक मान दर्ज करने के लिए कहें।
  2. num1 और num2 (पूर्णांक चर) में दो पूर्णांक मान पढ़ें।
  3. जांचें कि क्या num1 num2 से बड़ा है।
  4. अगर सही है, तो ‘num1’ को सबसे बड़ी संख्या के रूप में प्रिंट करें।
  5. यदि गलत है, तो ‘num2’ को सबसे बड़ी संख्या के रूप में प्रिंट करें।

Algorithm to find the greatest of two numbers

दो नंबरों में से सबसे बड़ा खोजने के लिए सी प्रोग्राम नीचे दिया गया है:-

Find the largest of two numbers using the if-else condition:

#include <stdio.h>
int main()
{
    int num1, num2;
    // Ask user to enter the two numbers
    printf("Please Enter Two different values\n");
    // Read two numbers from the user
    scanf("%d %d", &num1, &num2);
    if(num1 > num2)
    {
        printf("%d is Largest\n", num1);
    }
    else if (num2 > num1)
    {
        printf("%d is Largest\n", num2);
    }
    else
    {
        printf("Both are Equal\n");
    }
    return 0;
}

Output:-

Please Enter Two different values: 27  6
27 is Largest

Previous articleFrom Zero To Hero: Integration Testing In ASP. Net Core
Next articleswitch case statement in c programming examples|स्विच स्टेटमेंट क्या है?

LEAVE A REPLY

Please enter your comment!
Please enter your name here