Print the marks using return type and arguments in C


This program is about print the marks no return value and without argument using functions.

Source Code Example : 1

#include<stdio.h>
void marks();
int main()
{
   marks();
   return 0;
}
void marks()
{
   int tam,eng,mat,sci,soc,tot,avg;
   printf("\nEnter the Marks:");
   scanf("%d%d%d%d%d",&tam,&eng,&mat,&sci,&soc);
   tot=tam+eng+mat+sci+soc;
   avg=tot/5;
   printf("\nTotal Marks:%d",tot);
   printf("\nAverage:%d",avg);
   if(tot>230)
   {
      if(tot>=480)
      {
        printf("\nGrade:A");
      }
      else if(tot>400&&tot<480)
      {
        printf("\nGrade:B");
      }
      else if(tot<400)
      {
        printf("\nGrade:C");
      }
      printf("\nPass");
   }
   else
   {
    printf("\nFail");
   }
}
To download raw file Click Here

Output

Enter the Marks:99
87
96
95
96
Total Marks:473
Average:94
Grade:B
Pass


This program is about print the marks with return value and with argument using functions.

Source Code Example : 2

#include<stdio.h>
int marklist(int,int,int,int,int);
int main()
{
   int tam,eng,mat,sci,soc,tot,avg,ans;
   printf("\nEnter the Marks:");
   scanf("%d%d%d%d%d",&tam,&eng,&mat,&sci,&soc);
   ans=marklist(tam,eng,mat,sci,soc);
   printf("\nTotal:%d",ans);
   avg=ans/5;
   printf("\nAverage:%d",avg);
   return 0;
}
int marklist(int tam,int eng,int mat,int sci,int soc)
{
   int tot;
   tot=tam+eng+mat+sci+soc;
   return tot;
}         
To download raw file Click Here

Output

Enter the Marks:98
96
95
97
99
Total Marks:485
Average:97




This program is about print the marks no return value and with argument using functions.

Source Code Example : 3

#include<stdio.h>
void marklist(int,int,int,int,int);
int main()
{
   int tam,eng,mat,sci,soc,avg;
   printf("\nEnter the Marks:");
   scanf("%d%d%d%d%d",&tam,&eng,&mat,&sci,&soc);
   marklist(tam,eng,mat,sci,soc);
   return 0;
}
void marklist(int tam,int eng,int mat,int sci,int soc)
{
   int avg,tot;
   tot=tam+eng+mat+sci+soc;
   printf("\nTotal marks:%d",tot);
   avg=tot/5;
   printf("\nAverage mark:%d",avg);
   if(tot>250)
   {
      printf("\nPass");
   }
   else
   {
      printf("\nFail");
   }
}
 
To download raw file Click Here

Output

Enter the Marks:98
96
95
97
99
Total Marks:485
Average:97
Pass

This program is about print the marks with return value and without argument using functions.

Source Code Example : 4

include<stdio.h>
int marklist();
int main()
{
   int avg,total;
   total=marklist();
   printf("\nTotal marks:%d",total);
   avg=total/5;
   printf("\nAverage:%d",avg);
   return 0;
}
int marklist()
{
   int tam,eng,mat,sci,soc,tot,avg,ans;
   printf("\nEnter the Marks:");
   scanf("%d%d%d%d%d",&tam,&eng,&mat,&sci,&soc);
   tot=tam+eng+mat+sci+soc;
   return tot;
}       
To download raw file Click Here

Output

Enter the Marks:98
96
95
97
99
Total Marks:485
Average:97

List of Programs


Sample Programs


Switch Case in C


Conditional Operators in C


Goto Statement in C


While Loop Example Programs


Looping Statements in C

For Loop Example Programs


Array Examples in C

One Dimensional Array


Two Dimensional Array in C


String Example Programs in C


Functions Example Programs in C


Learn All in Tamil © Designed & Developed By Tutor Joes