0% found this document useful (0 votes)
18 views3 pages

SP 4

The document presents a structured programming assignment by a student named Atharva Gaikwad from the Information Technology branch. It includes a C program that performs arithmetic operations based on user input until the user enters zero to exit. The program allows addition, subtraction, multiplication, and division of two numbers, displaying the results accordingly.

Uploaded by

darkmatter100106
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views3 pages

SP 4

The document presents a structured programming assignment by a student named Atharva Gaikwad from the Information Technology branch. It includes a C program that performs arithmetic operations based on user input until the user enters zero to exit. The program allows addition, subtraction, multiplication, and division of two numbers, displaying the results accordingly.

Uploaded by

darkmatter100106
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

VIDYALANKAR INSTITUTE OF TECHNOLOGY

STRUCTURED PROGRAMMING
STUDENT'S Atharva Gaikwad ROLL 24101B0082 DATE:
NAME: NO. 01-12-24
BRANCH: Information Technology DIV: B EXP NO:
4
PROBLEM
STATEMENT WAP to do arithmetic operations till user enters Zero(0)
CODE: #include<stdio.h>

int main()

float a,b,y;

int c;

printf("Enter first number :");

scanf("%f",&a);

printf("Enter the second number :");

scanf("%f",&b);

printf("Choose operation:\n");

printf("0.Exit\n");

printf("1. Add\n");

printf("2. Subtract\n");

printf("3. Multiply\n");

printf("4. Divide\n");

while(1)

printf("Enter your choice: ");


scanf("%d", &c);

if (c== 0)

break;

switch(c)

case 1:

y = a + b;

printf("Addition : %f \n",y);

break;

case 2 :

y = a-b;

printf("Subtraction : %f\n",y);

break;

case 3 :

y = a*b;

printf("Multiplication : %f\n",y);

break;

case 4 :

y = a/b;

printf("Division : %f\n",y);
break;

default:

printf("Invalid choice. Please try again.\n");

printf("\n");

printf("Program ended.\n");

return 0;

}
OUTPUT:

You might also like