Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

wrie a c program tha gets two intergers,say x and y,compares them with a message like x is biggger than y

+1 vote
asked Apr 15, 2019 by Frankimurgor (220 points)

5 Answers

+1 vote
answered Apr 20, 2019 by Saurav Singh Chandela (160 points)
#include <stdio.h>

int main()
{   int x=3,y=5;
    x>y?printf("x = %d is greater than y", x):printf("y = %d is greater than x", y);
    

    return 0;
}
+1 vote
answered Apr 23, 2019 by Matthew Green (260 points)

#include<stdio.h>

void main()

{

int x;

int y;

scanf("%d",&x);

scanf("%d",&y);

if(x<y)

{

printf("%d is greater than %d",y,x);

}

if(y<x)

{

printf("%d is greater than %d",x,y);

}

}

+1 vote
answered Apr 24, 2019 by Harerimana Egide (160 points)
#include <stdio.h>

int main()
{
    int x;
    int y;
    printf("A c program to compare 2 numbers.\n");
    printf("_________________________________");
    printf("\n");
    printf("enter x:");
    scanf("%d",&x);
    printf("enter y:");
    scanf("%d",&y);
    printf("\n");
    if(x>y){
        printf("x is greater than y");
    }else if(y>x){
        printf("y is greater than x");
    }else{
        printf("They are equal!");
    }
    
    return 0;
}
+1 vote
answered May 2, 2019 by anonymous
#include<stdio.h>

int main(){

int x,y;

printf("Enter the value of x");

scanf("%d",&x);

printf("Enter the value of y");

scanf("%d",&y);

x>y ? printf("%d is bigger",x) : printf("%d is bigger",y);

}
+1 vote
answered May 2, 2019 by Manasa V.N
public class main

{   

     public static void main(String[] args)

     {

          int x, y;

          System.out.println("Enter two numbers to compare");

          if(x>y)

                  { System.out.println("x is grater than y");}

          else

          System.out.println("Y is grater than x");

    }

}
commented May 15, 2019 by Frankimurgor (220 points)
this approach far from my current capabilities in c programming ,but thank you.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...