Example 1:
// Arithmetic Operators in C
#include <stdio.h>
int main()
{
int a,b;
float c;
a = 5;
b = 2;
c - a + b;
printf("Sum of %d and %d is %.2f\n",a,b,c);
c = a * b;
printf("Product of %d and %d is %.2f\n",a,b,c);
c = a / b;
printf("Integer Division of %d and %d is %.2f\n",a,b,c);
c = (float)a / b;
printf("Real Division of %d and %d is %.2f\n",a,b,c);
return 0;
}
// Video Tutorial for how to run an Arithmetic Operator
Example 2:
// Arithmetic Operators in C++
#include <iostream>
using namespace std;
int main()
{
int a,b;
float c;
a = 5;
b = 2;
c = a + b;
cout <<"Sum of " <<a <<" and " <<b <<" is " <<c <<"\n";
c = a * b;
cout <<"Product of " <<a <<" and " <<b <<" is " <<c <<"\n";
c = a / b;
cout <<"Integer Division of " <<a <<" and " <<b <<" is " <<c <<"\n";
c = (float)a / b;
cout <<"Real Division of " <<a <<" and " <<b <<" is " <<c <<"\n";
return 0;
}
// Arithmetic Operators in C
#include <stdio.h>
int main()
{
int a,b;
float c;
a = 5;
b = 2;
c - a + b;
printf("Sum of %d and %d is %.2f\n",a,b,c);
c = a * b;
printf("Product of %d and %d is %.2f\n",a,b,c);
c = a / b;
printf("Integer Division of %d and %d is %.2f\n",a,b,c);
c = (float)a / b;
printf("Real Division of %d and %d is %.2f\n",a,b,c);
return 0;
}
// Video Tutorial for how to run an Arithmetic Operator
Example 2:
// Arithmetic Operators in C++
#include <iostream>
using namespace std;
int main()
{
int a,b;
float c;
a = 5;
b = 2;
c = a + b;
cout <<"Sum of " <<a <<" and " <<b <<" is " <<c <<"\n";
c = a * b;
cout <<"Product of " <<a <<" and " <<b <<" is " <<c <<"\n";
c = a / b;
cout <<"Integer Division of " <<a <<" and " <<b <<" is " <<c <<"\n";
c = (float)a / b;
cout <<"Real Division of " <<a <<" and " <<b <<" is " <<c <<"\n";
return 0;
}
This Website is Easy to Learn and usefull and my douts is remove after learn this website.
ReplyDelete