Problem 15: Capital

Take a small letter alphabet as input from the user and print the capital version of that letter. [If user gives input ‘a’ you should print ‘A’]

2,817 total views, 2 views today

Comments

comments

6 thoughts on “Problem 15: Capital”

  1. #include
    int main()
    {
    char str[1110];
    gets(str);
    for(int i=0;str[i]!=’\0′;i++)
    {
    if(str[i]>=’a’&&str[i]<='z')
    str[i]=str[i]-32;
    }
    printf("%s\n",str);
    return 0;
    }

  2. #include
    int main()
    {

    char ch;
    printf(“Enter any small later\n”);
    scanf(“%c”,&ch);
    if(ch==’a’){
    printf(“A”);
    }
    else if(ch==’b’){
    printf(“B”);
    }
    else if(ch==’c’){
    printf(“C”);
    }
    else if(ch==’d’){
    printf(“D”);
    }
    else if(ch==’e’){
    printf(“E”);
    }
    else if(ch==’f’){
    printf(“F”);
    }
    else if(ch==’g’){
    printf(“G”);
    }
    else if(ch==’h’){
    printf(“H”);
    }
    else if(ch==’i’){
    printf(“I”);
    }
    else if(ch==’j’){
    printf(“J”);
    }
    else if(ch==’k’){
    printf(“K”);
    }
    else if(ch==’l’){
    printf(“L”);
    }
    else if(ch==’m’){
    printf(“M”);
    }
    else if(ch==’n’){
    printf(“N”);
    }
    else if(ch==’o’){
    printf(“O”);
    }
    else if(ch==’p’){
    printf(“P”);
    }
    else if(ch==’q’){
    printf(“Q”);
    }
    else if(ch==’r’){
    printf(“R”);
    }
    else if(ch==’s’){
    printf(“S”);
    }
    else if(ch==’t’){
    printf(“T”);
    }
    else if(ch==’u’){
    printf(“U”);
    }
    else if(ch==’v’){
    printf(‘V’);
    }
    else if(ch==’w’){
    printf(“W”);
    }
    else if(ch==’x’){
    printf(“X”);
    }
    else if(ch==’y’){
    printf(“Y”);
    }
    else if(ch==’z’){
    printf(“Z”);
    }
    else{
    printf(“Please try again later\n”);
    }
    }

  3. #include

    int main()
    {
    char x;
    printf(“Enter only one small letter of alphabet : \n”);
    scanf(“%c”,&x);
    printf(“%c”,x=x-32);

    return 0;
    }

  4. #include

    int main()
    {
    char x;
    printf(“Enter only one small letter of alphabet : \n”);
    scanf(“%c”,&x);
    if(x>=97 && x<=122){
    printf("%c",x=x-32);}
    else{
    printf("Invailed Entry");
    }

    return 0;
    }

  5. #include
    int main(){
    char ch,CH;
    scanf(“%c”,&ch);
    CH=ch-32;
    printf(“\nprint the capital version of that letter is:%c\n\n”,CH);

    return 0;
    }

Leave a Reply

Your email address will not be published.