WAP to enter two numbers and check if they have same length and same digits or not.
Example:-
123
456
Output:- Yes of same length but same digits are not present
123
321
Output:- Yes of same length and same digits are present.
Answers
Answered by
0
Answer:
#include<studio.h>
void main()
{
int a[10],b[10],n,i,j,x,y,c=0,d=0,m=0;
printf ("enter inputs:");
scanf("%d,%d",&x,&y);
scanf("%d",&n);
for(i=0;i<n;i++)
{
a[i]=x%10;
x=x/10;
c++;
}
for (j=0;j<n;j++)
{
b[j]=y%10;
y=y/10;
d++;
}
if(c==d)
{
for(i=0;i<n;i++)
{
for (j=0;j<n;j++)
{
if(a[i]==b[j])
m++;
}
}
if(c==m)
printf("same length same digits");
else
printf("same length ,but not digits");
}
else
printf("lengths are not same");
}
Similar questions