0% found this document useful (0 votes)
23 views1 page

Main Ex2-1

The document contains code for a C program that takes in two numbers and an operator from the user and performs the corresponding arithmetic operation on the numbers. It uses scanf to take in user input, switch statement to check the operator, and printf to output the result.

Uploaded by

NANO BIKER
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)
23 views1 page

Main Ex2-1

The document contains code for a C program that takes in two numbers and an operator from the user and performs the corresponding arithmetic operation on the numbers. It uses scanf to take in user input, switch statement to check the operator, and printf to output the result.

Uploaded by

NANO BIKER
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/ 1

#include <stdio.

h>
#include <stdlib.h>

int main()
{
char o;
int A,B;
printf("Entrer l operateur + - * / :");
scanf("%c",&o);
printf("Entrer A :");
scanf("%d",&A);
printf("Entrer B :");
scanf("%d",&B);
switch(o)
{
case '+':printf("Somme = %d",A+B);break;
case '-':printf("soustraction = %d",A-B);break;
case '*':printf("Produit = %d",A*B);break;
case '/':printf("division = %d",A/B);break;
default:printf("Operateur invalide");

return 0;
}

You might also like