HI ! FRIENDS
TO PRINT ROTATION OF THE NUMBER AND PRINT BIGGEST AMOUNG THEM:
#include<stdio.h>
int main()
{
int r,q,s,n,d,a[100],i,j,t;
printf("Enter no of digits");
scanf("%d",&d);
printf("%d digit number",d);
scanf("%d",&n);
if(d==1)
{
printf("%d is biggest number",n);
}
else if(d==2)
{
s=10;
}
else if(d==3)
{
s=100;
}
else if(d==4)
{
s=1000;
}
else
{
printf("may be not possible");
}
for(i=0; i<d; i++)
{
r=n%10;
q=n/10;
n=r*s+q;
a[i]=n;
printf("%d\n",n);
}
for(i=0; i<d; i++)
{
for(j=i+1; j<d; j++)
{
if(a[i]<a[j])
{
t=a[i];
a[i]=a[j];
a[j]=t;
}
}
}
printf("among these biggest is %d",a[0]);
}
https://www.onlinegdb.com/online_c_compiler
SAMPLE OUTPUT:
Learn with jagadeesh
copyright© to jagadeesh
YO
Post a Comment