The addition, subtruction, division & multiply of two numbers using Array.

Bismillahir Rahmanir Rahim
At first take my salam. now I'm write a program (+, -, /, *) of two numbers using Array.To solve this problem,At first you take/declare  a Array like as a[4] or n[6] or s[8].
All of we know that a[4] means = a[0],a[1],a[2],a[3]
                        and a[n] = a[0],a[1],a[2],..........,a[n-1]
here,
      a = variable_name.
      n = Array size.
.
Solution:

#include<stdio.h>
void main()
{
 float a[6];
 printf("Enter two numbers:\n");
 scanf("%f%f",&a[0],&a[1]);
 a[2]=a[0]+a[1];
 a[3]=a[0]-a[1];
 a[4]=a[0]/a[1];
 a[5]=a[0]*a[1]; //iubatians.blogspot.com
 printf("The sum=%.2f\n",a[2]);
 printf("The subtraction=%.2f\n",a[3]);
 printf("The division=%.2f\n",a[4]);
 printf("The multiply=%.2f\n",a[5]);
}
Here. %.2f means after point it hase taken two digit.
example:
your result is 25.3645
if you write %.2f then the result will be 25.36.
if you have any question comment below.

Socializer Widget By Blogger Yard
SOCIALIZE IT →
FOLLOW US →
SHARE IT →