Monday, March 1, 2010

StringUpLow(aXybIM)->(AxYBim)

  INPUT        : axVyUddE  

 OUTPUT     : AXvYuDDe 

         POSTER      :AVINASH


Solutions :


BY VILAS 
  
#include
int main()
{
      char source[20],dest[20];
      int i=0,j=0;
     
      printf("ENTER THE STRING\n");
      scanf("%s",source);

      while(source[i]!='\0')
      {
            if(source[i]>=97)
            {
            dest[j]=source[i]-32;
            }
            else
            {
                  dest[j]=source[i]+32;
            }
            i++;
            j++;
      }
      dest[j]='\0';
      printf("%s",dest);
      return 0;
}




#include "stdafx.h"
#include "stdio.h"
#include "stdlib.h" 
#include "string"  //For memset

int _tmain(int argc, _TCHAR* argv[])
{     
       char szWord[20],szResult[20],iNum=0;
       memset(szWord , 0x00, sizeof(szWord));
       memset(szResult, 0x00, sizeof(szResult));
       printf("Enter a String OR alphabet:");
       scanf("%s",szWord);
       printf("\n");
       for(iNum=0; szWord[iNum]!= NULL && iNum<20; iNum++ )   //keeping track of the number of characters entered
       {
             if(szWord[iNum]>64 && szWord[iNum]<91)          //Checking if the Alphabet is small r big
                    szResult[iNum] = szWord[iNum]+32;           //converting it to upper
             else
                    szResult[iNum] = szWord[iNum]-32;           //converting it to lower
       }
       szResult[iNum+1]='\0';                              //Adding Null to the END as for loop gets exited before adding it
       printf("\n Result: %s",szResult);
             return 0;
}


by EZHILMANI

#include
void inverse(char * ptr)
{
      char *a = ptr;
      while(*ptr!=NULL)
      {
            if((*ptr>=97)&&(*ptr<=122))
                  *ptr= *ptr -32;
            else if( (*ptr>=65)&&(*ptr<=90))
                        *ptr = *ptr +32;
            ptr++;
      }

      printf("%s",a);

}
int main()
{
      char a[20]="EZHILmani";
      inverse(a);
     
      return 0;
}


No comments:

counter