#include <stdio.h>
#include <conio.h>

float xulytinhtoan (int a , int b , char pheptoan)
{
	if(pheptoan == &#039;+&#039;)
	{
	   return a + b;
	}
	if(pheptoan == &#039;-&#039;)
	{
	   return a - b;
	}
	if (pheptoan == &#039;*&#039;)
	{
	   return a*b;
	}
	else
	{
		return (float) a / b ;
	}


}
int main()
	// cach goi ham dang 2 
{     
	int a = 1;
	 int b = 2;

	  int tong = xulytinhtoan (a, b , &#039;+&#039;);
	  int hieu  = xulytinhtoan (a, b , &#039;-&#039;);
	  int tich = xulytinhtoan (a, b , &#039;*&#039;);
	  float thuong = xulytinhtoan (a, b , &#039;/&#039;);
	  printf("\n%d",tong);
	  printf("\n%d",hieu);
	  printf("\n%d",tich);
	  printf("\n%f",thuong);
	
	getch();
	return 0;



}

Add a code snippet to your website: www.paste.org