hseb19 solution:program to do different operation using switch

//program to carry out different operation  using switch.
void main()
int choice;
int length_rect,breadth_rect;
char string[200];
printf("'we have following menu\n");
printf( "1.to get length of string\n");
printf("2. to get area of rectangle\n");
printf("3 to reverse a string\n");
printf("4 exit");
printf("enter your choice 1 or 2 or 3 or 4\n");
                  case 1:
                            printf("we are going to get length of string\n");
                            printf("enter string\n");
                           printf("the length=%d",strlen(string));
               case 2:
                            printf("we are going to get area of rectangle\n");
                            printf("enter its length and breadth\n");
                            printf("the area=%d",length_rect*breadth_rect);

               case 3:
                            printf("we are going to reverse the string\n");
                            printf("enter your string\n");
                           printf("the reverse=%s",strrev(string));
             case 4:
                            printf("we are going to exit\n");

                            printf("sorry, not a valid input\n");
                            printf("thank u, terminating....\n");

No comments:

Post a Comment