Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- int n,m,k,b,maks;
- int energia[100][4];
- int max[100];
- int max1[100];
- int odbiorcy(int n);
- int main() {
- printf("Podaj ilość odbiorców ");
- scanf("%i",&n);
- odbiorcy(n);
- wypisz(n);
- return 0;
- }
- int odbiorcy(int n)
- {
- maks=0;
- for(k=0;k<n;k++)
- {
- for(b=0;b<4;b++)
- {
- printf("Podaj wartość energi odbiorcy nr %i w kwartale %i ",k+1,b+1);
- scanf("%i",&energia[k][b]);
- if(maks<energia[k][b])
- {
- maks=energia[k][b];
- max[k]=b+1;
- max1[k]=maks;
- }
- }
- }
- }
- int wypisz(int n)
- {
- for(k=0;k<n;k++)
- {
- printf("Najwyższa wartość pobranej energii przez odbiorce nr %i była w kwartale %i a jej wartość to %i\n\n",k+1,max[k],max1[k]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement