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 and vice - versa

Posted By: Adalhelm Fischer     Category: C Programming     Views: 7139

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 and vice - versa 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: 



Adalhelm Fischer
Adalhelm Fischer author of Program that accepts characters in lower case, stores them in an array and prints them in the upper-case and vice - versa is from Frankfurt, Germany.
 
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!