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.

Input 3 numbers & output 1 if 3 numbers are diffrent & output 0 if numbers are repeated.

–4 votes
asked Jul 30, 2019 by Arjun pradeep
You will be given 3 integers as input. The inputs may or may not be different from each
other. You have to output 1 if all three inputs are different from each other, and 0 if any
input is repeated more than once.
Input----- Three integers on three lines.
Output------ 1 if the three inputs are different from each other,
0 if some input is repeated more than once.

7 Answers

0 votes
answered Jul 30, 2019 by cj
#include<stdio.h>

int main(){

int a,b,c;

scanf("%d %d %d",&a,&b,&c);

if(a==b||b==c||c==a)

printf("0");

else

printf("1");

return 0;

}
0 votes
answered Jul 30, 2019 by Sravan Karri
#include<stdio.h>

int main()

{

int a,b,c;

scanf("%d%d%d",&a,&b,&c);

if(a!=b&&a!=c&&b!=c)

printf("1");

else

printf("0");

return 0;

}
0 votes
answered Jul 30, 2019 by anonymous
a,b,c=3,3,3

if (a==b==c): print(0)
elif(a in [b,c] or b in [a,c] or c in [a,b]): print(1)
0 votes
answered Jul 30, 2019 by Adwaid R
num1=int(input("Enter 1st number : ")) #

num2=int(input("Enter 1st number : "))

num3=int(input("Enter 1st number : "))

if(num1==num2):

    print("0")

elif(num1==num3):

    print("0")

elif(num2==num3):

    print("0")

else:

    print("1")
0 votes
answered Jul 30, 2019 by Arghya Bhattacharya (140 points)
#This code is in python version 3
a=int(input("Enter first number: "))
b=int(input("Enter second number: "))
c=int(input("Enter third number: "))
if a==b or b==c or a==c:
    print("0")
else:
    print("1")
0 votes
answered Jul 30, 2019 by Pran

#include <stdio.h>

int main()

{

int a,b,c;

scanf("%d%d%d",&a,&b,&c);

if(a!=b&&b!=c&&c!=a)

{

printf("1");

}

else

{

printf("0");

}

return(0);

}

0 votes
answered Jul 31, 2019 by Bhekokwakhe
#include <iostream>
#include<cmath>
using namespace std;
int main()
{
    int num1, num2, num3;
    cout<< "enter three numbers: ";
    cin>>num1;
    cin>>num2;
    cin>>num3,
    cout<<endl;
    if (num1 == num2 & num2 == num3)
        cout<<"one" <<endl;
    else
        cout<<"zero" <<endl;
       
    return 0;
}
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.
...