IGNOU MCS-011 Problem Solving and Programming Solved Assignment 2021-22 Q1 | C Program using switch statement to provide the following functions
IGNOU MCS-011 Problem Solving and Programming Solved Assignment 2021-22 | C Program using switch statement to provide the following functions
Course Code : MCS-011
Course Title : Problem Solving and Programming
Assignment Number : BCA(2)/011/Assignment/2021-22
Maximum Marks : 100
Weightage : 25%
Last Dates for Submission : 31st October, 2021 (For July Session)
15th April, 2022 (For January Session)
 #include<stdio.h>
#include<conio.h>
void sum(int x, int y)
 {
     printf("Sum of %d and %d is %d\n",x,y,(x+y) );
 }
 void rem(int x, int y)
 {
    printf("Remainder after division of  %d by %d is %d\n",x,y,x%y);
 }
 void prod(float x, float y)
 {
    printf("Product of %f and %f is %f\n",x,y,(x*y) );
 }
 void word(char s[])
 {
    printf("Print input word twice is %s %s\n",s,s );
 }
 void main()
  {
    int x,y,choice;
    float a,b;
    char str[15];
    clrscr();
    printf("Enter your choice\n");
    printf("Press 1 for Sum of two integers\n");
    printf("Press 2 for Remainder after division of two integers\n");
    printf("Press 3 for Product of two floats\n");
    printf("Press 4 for Print input word twice\n");
    scanf("%d",&choice);
    switch(choice)
    {
    case 1: printf("Enter the value of x and y\n");
        scanf("%d%d",&x,&y);
        sum(x,y);
        break;
    case 2: printf("Enter the value of x and y\n");
        scanf("%d%d",&x,&y);
        rem(x,y);
        break;
    case 3: printf("Enter the value of a and b\n");
                scanf("%f%f",&a,&b);
                prod(a,b);
                break;
        case 4: printf("Enter a word\n");
                scanf("%s",str);
                word(str);
                break;
        default: printf("Wrong choice\n");
     }
     getch();
  }
Note: You can understand for watching the video on YouTube Channel named as Gaurav Pali
and the link for this video
https://youtu.be/eGP8fDrJszw