Tuesday, 8 May 2012

UVa 11172 Relational Operators Solution

#include<stdio.h>
int main()
{
int a,b,c,i;
while(scanf("%d",&a)==1)
{
for(i=0;i<a;i++)
    {
    scanf("%d%d",&b,&c);
    if(b>c)
    printf(">\n");
    else if(b<c)
    printf("<\n");
    else
    printf("=\n");
    }
}
return 0;
}

13 comments:

  1. Will this work too?
    #include

    int main()
    {
    int n,a,b;
    scanf("%d",&n);
    if(n<15)
    for(int i=0;ib)
    {
    printf(">\n");
    }
    else if(a<b)
    {
    printf("<\n");
    }
    else
    printf("=\n");
    }

    }

    ReplyDelete
  2. getting wrong answer

    #include
    #include
    using namespace std;

    int main() {
    int first_number, secound_number,i,a;
    cin >> i;
    for (a = 0; a <= i; a++)
    {
    cin >> first_number >> secound_number;
    if (first_number>secound_number)
    {
    cout << ">" << "\n";
    }
    else if (first_number<secound_number)
    {
    cout << "<" << "\n";
    }
    else
    {
    cout << "=" << "\n";
    }

    }
    return 0;
    }

    ReplyDelete
    Replies
    1. #include
      #include

      int main()
      {

      int num1,num2,i,t;
      int temp1,temp2;

      scanf("%d",&t); // how many lines of input

      if(t < 15)// if t is less than 15 than we can carry on
      {
      for(i = 0; i < t; i++)
      {

      scanf("%d %d",&num1, &num2); // two inputs
      temp1 = abs(num1);
      temp2 = abs(num2);

      if((temp1 < 1000000001) && (temp2 < 1000000001))
      {
      if(num1 > num2)
      {
      printf(">\n");
      }
      else if(num1 < num2)
      {
      printf("<\n");
      }
      else
      {
      printf("=");
      }
      }

      }

      }




      return 0;
      }

      about to upload but i think it has something to do with the way its worded.... like both absolute values must be below 1000000001, but i dont think your doing the test on the absolute value..... these questions are brutal lol btw what module is this question in i just found it in the internet. ??? doesn't give me the file path

      Delete
  3. Why is it a wrong answer???


    #include
    using namespace std;

    int main(){
    int t;
    long int a[t],b[t];
    cin>>t;
    for(int i=0;i>a[i]>>b[i];
    }

    for(int j=0;jb[j])
    cout<<">\n";
    else if(a[j]<b[j])
    cout<<"<\n";
    else if(a[j]==b[j])
    cout<<"=\n";

    }

    return 0;

    }

    ReplyDelete
  4. I don't understand inside while loop's condition. it seems to me the condition is false.

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. #include

    int main()
    {
    int a,b,t;
    scanf("%ld",&t);
    for(t=0; t<15; t++)
    {
    scanf("%ld%ld",&a,&b);

    if(a>b)
    {
    printf(">\n");

    }
    else if(a==b)
    {
    printf("=\n");

    }

    else
    {
    printf("<\n");
    }
    }

    return 0;
    }
    whats the problem in there

    ReplyDelete
  7. #include

    int main()
    {
    int a,b,t;
    scanf("%d",&t);
    for(t=0; t<15; t++)
    {
    scanf("%d%d",&a,&b);

    if(a>b)

    printf(">\n");

    else if(a==b)

    printf("=\n");

    else

    printf("<\n");

    }

    return 0;
    }
    whats the problem in there?

    ReplyDelete
  8. why oyu use while loop in this porgram ?

    ReplyDelete
  9. why its wrong? please helo me

    #include

    int main()
    {
    int t,i,a,b;
    scanf("%d",&t);
    for(i=1;i<=t;i++){
    scanf("%d%d",&a,&b);
    if(a>b){
    printf(">\n");
    }
    else if(a<b){
    printf("<\n");
    }
    else{
    printf("=\n");
    }
    }

    }

    ReplyDelete
  10. Respect and I have a keen proposal: How Much Full House Renovation Cost house renovation ideas interior

    ReplyDelete