Search
 
SCRIPT & CODE EXAMPLE
 

C

c for result

/**
 * C program to calculate total, average and percentage of five subjects
 */

#include <stdio.h>

int main()
{
    float eng, phy, chem, math, comp; 
    float total, average, percentage;

    /* Input marks of all five subjects */
    printf("Enter marks of five subjects: 
");
    scanf("%f%f%f%f%f", &eng, &phy, &chem, &math, &comp);

    /* Calculate total, average and percentage */
    total = eng + phy + chem + math + comp;
    average = total / 5.0;
    percentage = (total / 500.0) * 100;

    /* Print all results */
    printf("Total marks = %.2f
", total);
    printf("Average marks = %.2f
", average);
    printf("Percentage = %.2f", percentage);

    return 0;
}
Comment

PREVIOUS NEXT
Code Example
C :: string to number in c 
C :: Returns numbers between i and 0 
C :: swap using third variable 
C :: can we use logical operators in switch c 
C :: how to check file pointers in c 
C :: metw.cc 
C :: convert c to phyton 
C :: run a command in cmd with c 
C :: convert c code to python online free 
C :: C Character l/O 
C :: ask the user if they would like to do something again in C 
C :: c create array 
C :: creation of a thread 
C :: minimun number of moves in c 
C :: buble sort in c that ask user input 
C :: man write c 
C :: gnunet 
C :: how to compress a file in c 
C :: bullseye lxc network problem 
C :: Odd-Even-inator with function in C 
C :: using tables as arguments in c++/c 
C :: #include <stdio.h int main() { int x = 10, *y, **z; y = &x; z = &y; printf(""%d %d %d"", *y, **z, *(*z)); return 0; } 
C :: online c compiler with mpi 
C :: Word Processor, Spreadsheet and Presentation Software are the examples of 
C :: array of string in c 
C :: mitch mcconnell 
Dart :: dart regex for email 
Dart :: flutter check if string is number 
Dart :: italic text flutter 
Dart :: flutter array of strings 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =