oh man!!!!!!!!!!!!!!!!!!!! finally... guys!!!!!! i completed the code.. thanks gaurav, that flag idea of urs saved my butt.... and ur if() STATEMENT is very clear now...
here's the code
Code:
#include<stdio.h>
#include<conio.h>
#include<math.h>
void low_up(char *);
void main()
{
char ch[4];
int temp[4],i,hex=0,dec=0;
clrscr();
printf("Enter a hexadecimal number");
for(i=0;i<4;i++)
{
scanf("%c", &ch[i]);
}
for(i=0;i<4;i++)
{
if((ch[i]>='a' && ch[i]<='f')||(ch[i]>='A' && ch[i]<='F'))
hex++;
else
dec++;
}
if(dec==4)
printf("This is not a hexadecimal number");
else
{
printf("This is a hexadecimal number");
low_up(ch);
}
for(i=0;i<4;i++)
printf("%c", ch[i]);
getch();
}
void low_up(char *j)
{
int k;
for(k=0;k<4;k++)
{
if(*j>=97 && *j<=102)
*j=*j - 32;
else if(*j>=65 && *j<=70)
*j=*j + 32;
j++;
}
}