Home » , » Basic C Programming Practice - Practice 10

Basic C Programming Practice - Practice 10

Written By Unknown on Thursday, October 10, 2013 | 11:39 PM

=>Write a program in C to perform relational operations of two float numbers?





Solution:

#include<stdio.h>
#include<conio.h>
main()
{
      float x,y;
      printf("Enter First Number : ");
      scanf("%f",&x);
      printf("Enter Second Number : ");
      scanf("%f",&y);
      if(x==y)
      printf("The Numbers Are Equal.");
      else
      if(x>y)
      printf("First Number Is Bigger Than Second.");
      else
      printf("Second Number Is Bigger Than First.");
      getch();

      }

Program Analysis :
The condition was to compare two float number and that's why we declare float data type variable "x" and "y" .First we take the first number from terminal or user and then we went for second.
We put the expressions and write this program by using a chain of  "if else if".That's It.................. 

Share this article :

Post a Comment

 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2011. Learn Programming - All Rights Reserved
Template Created by Creating Website Published by Mas Template
Proudly powered by Blogger| Distributed by Rocking Templates