UVA 10921

Solve in C:

#include<stdio.h>
int main()
{
char c;
while(scanf("%c",&c)!=EOF)
{
    if(c=='A'||c=='B'||c=='C')
    printf("2");
    else if(c=='D'||c=='E'||c=='F')
    printf("3");
    else if(c=='G'||c=='H'||c=='I')
    printf("4");
     else if(c=='J'||c=='K'||c=='L')
    printf("5");
   else if(c=='M'||c=='N'||c=='O')
    printf("6");
    else if(c=='P'||c=='Q'||c=='R'||c=='S')
    printf("7");
    else if(c=='V'||c=='T'||c=='U')
    printf("8");
   else  if(c=='Y'||c=='W'||c=='X'||c=='Z')
    printf("9");
   else
    printf("%c",c);

}
return 0;
}

No comments

Most View Post

Recent post

Codeforces Round 971 (Div. 4) 2009C. The Legend of Freya the Frog Solution

  Problem Link    https://codeforces.com/contest/2009/problem/C S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. h ...

Powered by Blogger.