fork download
  1. #include<stdio.h>
  2. void func(int a, int b, int c, float *avg, float *per);
  3. void main()
  4. {
  5. int a, b, c;
  6. float tot, per;
  7.  
  8. printf("Enter the marks of subject 1: ");
  9. scanf("%d", &a);
  10. printf("Enter the marks of subject 2: ");
  11. scanf("%d", &b);
  12. printf("Enter the marks of subject 3: ");
  13. scanf("%d", &c);
  14.  
  15. func(a, b, c, &tot, &per);
  16.  
  17. printf("\n The Total: %.2f", tot);
  18. printf("\n The Percentage: %.2f%%", per);
  19. }
  20.  
  21. void func(int a, int b, int c, float *tot, float *per)
  22. {
  23. *tot = (a+b+c);
  24. *per = ((a+b+c)/300.0)*100;
  25. }
  26.  
Success #stdin #stdout 0.02s 25984KB
stdin
Standard input is empty
stdout
#include<stdio.h>
void func(int a, int b, int c, float *avg, float *per);
void main()
{
    int a, b, c;
    float tot, per;

    printf("Enter the marks of subject 1: ");
    scanf("%d", &a);
    printf("Enter the marks of subject 2: ");
    scanf("%d", &b);
    printf("Enter the marks of subject 3: ");
    scanf("%d", &c);

    func(a, b, c, &tot, &per);

    printf("\n The Total: %.2f", tot);
    printf("\n The Percentage: %.2f%%", per);
}

void func(int a, int b, int c, float *tot, float *per)
{
    *tot = (a+b+c);
    *per = ((a+b+c)/300.0)*100;
}