Header Ads

ad728
  • New Updates

    Relational Operator Program



    Relational Operator Program

      
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    	printf("\n 10 is equal to [10==10]:%d",10==10);
    	printf("\n 10 s less than 100 [10<100 100="" 10="" d="" greater="" is="" n="" printf="" than=""> 10]:%d",100>10);
    	printf("\n 10 is less than or equal to 10[10<=10]:%d",10<=10);
    	printf("\n 10 is greater than or equal to 10[10>=10]:%d", 10>=10);
    	printf("\n 11 is not equal to 10[11!=10]:%d",11!=10);
    	putchar('\n');
    	printf("\n 10 is equal to 11 [10==11]:%d",10==11);
    	printf("\n 100 is less than 10 [100<10 100="" 10="" d="" greater="" is="" n="" printf="" than="">100]:%d",10>100);
    	printf("\n 11 is less than or equal to 10[11<=10]:%d",11<=10);
    	printf("\n 10 is greater than or equal to 11[10>=11]:%d",10>11);
    	printf("\n 10 is not equal to 10 [10!=10]:%d",10!=10);
    	getch();
    }
    
    

    Output

    10 is equal to [10==10]:1 10 s less than 100 [10<100 100="" 10="" greater="" is="" than=""> 10]:1 10 is less than or equal to 10[10<=10]:1 10 is greater than or equal to 10[10>=10]:1 11 is not equal to 10[11!=10]:1 10 is equal to 11 [10==11]:0 100 is less than 10 [100<10 100="" 10="" greater="" is="" than="">100]:0 11 is less than or equal to 10[11<=10]:0 10 is greater than or equal to 11[10>=11]:0 10 is not equal to 10 [10!=10]:0

    हालांकि इस Program को सरल बनाए रखने के लिए हमने Literals का प्रयोग किया है | लेकिन यदि हम चाहें तो विभन्न प्रकार के मानों को विभन्न प्रकार के Variables या Constant Identifier में Store करके उन Identifiers की भी आपस में तुलना कर सकते है | ऐसा करने पर भी प्राप्त होने वाले परिणाम में किसी प्रकार का कोई Change नहीं होता है |

    उदाहरण के लिए यदि इसी Program में हम तीन Integer प्रकार के Variables A, B C Create करें और उनमें क्रमशः 10 , 11 100 Store कर दे , और फिर पिछले Program में हमने जहां – जहां Integer Literal 10 को Use किया है , वहां Identifier A को जहां जहां Integer Literal B को व जहां जहां Integer Literal  100 को use किया है , वहां - वहां Identifier C को Replace कर दे , तो भी हमें प्राप्त होने वाला Output वही प्राप्त होगा , जो इस Program से प्राप्त हो रहा है


    No comments

    Post Top Ad

    ad728

    Post Bottom Ad

    ad728