#include<stdio.h>
main()
{
int n,a[20],r,i=0,j;
clrscr();
printf("enter element:\n");
scanf("%d",&n);
while(n>0)
{
r=n%26;
if(r==0)
{
r=26;
n=n-1;
}
a[i]=r;
i++;
n=n/26;
}
for(j=i-1;j>=0;j--)
printf("%c",a[j]+64);
getch();
}
Wednesday, October 28, 2015
Excel element no to sheet address program in c
Arrange Array Elements Using Array Index
# include <stdio.h>
# include <conio.h>
/* arrange array */
main()
{
int i[5]={4,3,1,0,2};
int val[5]={7,9,10,1,8};
int j,pos,tmp,tmp_pos;
int x,y;
for(x=0;x<=3;x++)
{
for(y=x+1;y<=4;y++)
{
if(i[x]>i[y])
{
tmp=val[x];
val[x]=val[y];
val[y]=tmp;
tmp=i[x];
i[x]=i[y];
i[y]=tmp;
}
}
}
clrscr();
for(j=0;j<=4;j++)
printf("%3d,",val[j]);
}
Subscribe to:
Comments (Atom)