Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Program that accepts characters in lower case, stores them in an array and prints them in the upper-case

Posted By: Nina Garcia     Category: C Programming     Views: 2661

Write a program that accepts characters in lower case, stores them in an array and prints them in the upper-case and vice - versa.

Code for Program that accepts characters in lower case, stores them in an array and prints them in the upper-case in C Programming

#include<stdio.h>
#include<conio.h>
void main()
{
        char a[10],a1[10];
        int i,j,n;
        clrscr();
        printf("\n Please Give The Value of N:  ");
        scanf("%d",&n);
        for(i=0;i<n;i++)
        {
            flushall();
            printf("\n enter value of a[%d] :",i);
            scanf("%c",&a[i]);

            if(a[i]>=97 && a[i]<=122)
            {
                a1[i]=a[i]-32;
                printf("\n  NOW IN UPPERCASE  %c ",a1[i]);
            }
            if(a[i]>=65 && a[i]<=90)
            {
                a1[i]=a[i]+32;
                printf("\n  NOW IN LOWERCASE  %c ",a1[i]);
            }
        }
        printf("\n\nTHE TOTAL STRING IS ");
        for(i=0;i<n;i++)
            printf("%c",a1[i]);
        getch();
}


********************* OUTPUT ************************************************

     Please Give The Value of N:  4

     enter value of a[0] :A

      NOW IN LOWERCASE  a
     enter value of a[1] :L

      NOW IN LOWERCASE  l
     enter value of a[2] :A

      NOW IN LOWERCASE  a
     enter value of a[3] :Y

      NOW IN LOWERCASE  y

    THE TOTAL STRING IS alay


***********************************************************************
  
Share: 



Nina Garcia
Nina Garcia author of Program that accepts characters in lower case, stores them in an array and prints them in the upper-case is from St Louis, United States.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!