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

RESTful APIs with CRUD Operations in Laravel 12| (2025)

  RESTful APIs serve as the foundation of modern web development. They follow a set of rules called Representational State Transfer (REST) t...

Powered by Blogger.