Monday, 8 April 2013
array 1
#include<stdio.h>
void main()
{
int total[4];
int a[3];
int b[3];
int no_loop;
int item;
item=3;
total[0]=0;
total[1]=0;
total[2]=0;
total[3]=0;
for(no_loop=0; no_loop<=2; no_loop++)
{
printf("enter the value of the item a[%d]:", no_loop);
scanf("%d", &a[no_loop]);
}
for(no_loop=0; no_loop<=2; no_loop++)
{
printf("enter the value of item b[%d]:", no_loop);
scanf("%d", &b[no_loop]);
}
for(no_loop=0; no_loop<=2; no_loop++)
{
total[2]=total[2]+(a[no_loop]*b[no_loop]);
}
for(no_loop=0; no_loop<=2; no_loop++)
{
total[0]=total[0]+a[no_loop];
}
for(no_loop=0; no_loop<=2; no_loop++)
{
total[1]=total[1]+b[no_loop];
}
printf("The sum total value a is %d\n",total[0]);
printf("The sum total value b is %d\n",total[1]);
printf("The sum of multiply of a and b is %d\n",total[2]);
printf("The total a x b divide a is %.2f\n\a",(float)total[2]/total[0]);
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment