#include <stdio.h>
main() {
int a,b,c;
float d[3],e[3],g=0,z=0;
char f[3] = {'a','b','c'};
for (a=1;a<=2;a++) {
printf("Person no. %d \n",a);
for (b=1;b<=3;b++) {
printf("Enter amount of piece %c >>> ",f[b-1]);
scanf("%f",&d[b-1]);
printf("Enter price<baht> >>> ");
scanf("%f",&e[b-1]);
g = g+(e[b-1]*d[b-1]);
printf("Price of %c is %.2f\n",f[b-1],e[b-1]*d[b-1]);
}
printf("--------- Total's person 1 %.2f-------------\n",g);
z = z+g;
}
printf("************ Two person are %.2f******************\n",z);
} |
#include <stdio.h>
main() {
int a,b,c;
float d[3],e[3],g=0,z=0;
char f[3] = {'a','b','c'};
for (a=1;a<=2;a++) {
printf("Person no. %d \n",a);
for (b=1;b<=3;b++) {
printf("Enter amount of piece %c >>> ",f[b-1]);
scanf("%f",&d[b-1]);
printf("Enter price<baht> >>> ");
scanf("%f",&e[b-1]);
g = g+(e[b-1]*d[b-1]);
printf("Price of %c is %.2f\n",f[b-1],e[b-1]*d[b-1]);
}
printf("--------- Total's person 1 %.2f-------------\n",g);
z = z+g;
}
printf("************ Two person are %.2f******************\n",z);
}
#include <stdio.h>
int function1 (int x,int y) {
int c;
c = (x+y)*100;
return(c);
}
main() {
int a,x,y;
printf("Enter Number I >>>> ");
scanf("%d",&x);
printf("Enter Number II >>>>>");
scanf("%d",&y);
a = function1(x,y);
if (x+y>=50) {
printf("Function 1 (sum*100) is %d\n",a);
}
} |
#include <stdio.h>
int function1 (int x,int y) {
int c;
c = (x+y)*100;
return(c);
}
main() {
int a,x,y;
printf("Enter Number I >>>> ");
scanf("%d",&x);
printf("Enter Number II >>>>>");
scanf("%d",&y);
a = function1(x,y);
if (x+y>=50) {
printf("Function 1 (sum*100) is %d\n",a);
}
}