Java Netbeans Application To Find Out Total, Percentage Of Any Three Subjects.

Q5. Design a GUI application to find out Total, Percentage of any three subjects (Subject marks not more than 100).

Sol:

Create a GUI application as per following screenshot.

Type the following code by double clicking BtnTot, button, below the line that says, ‘// TODO add your handling code here’ Read More …

Write a C++ program to take input in three subjects Physics, Chemistry and Math’s and calculate the total and percentage.

Q15. Write a C++ program to take input in three subjects Physics, Chemistry and Math’s and calculate the total and percentage.

Solution:

#include<iostream.h> //standard input/output header file

#include<conio.h> //for clrscr()

 

int main()

{

int Phy,Chem,Maths,total,per;

 

clrscr(); //for clearing the screen

 

cout<<“\n Enter the marks of Physics: “;

cin>>Phy;

cout<<“\n Enter the marks of Chemistry: “;

cin>>Chem;

cout<<“\n Enter the marks of Math’s: “;

cin>>Maths;

 

total=Phy+Chem+Maths;

per=total/3;

 

cout<<“\n Total= “<<total;

cout<<“\n Percentage= “<<per<<“%”;

 

getch(); //holds the screen until any key is pressed

return 0; //makes main() finish

}

 

OUTPUT:

Enter the marks of Physics: 78

Enter the marks of Chemistry: 89

Enter the marks of Math’s: 90

Total= 257

Percentage= 85%

C Program To Take Input In Three Subjects Physics, Chemistry And Math’s And Calculate The Total And Percentage.

Q15. Write a C program to take input in three subjects Physics, Chemistry and Math’s and calculate the total and percentage.

Solution:

#include<stdio.h> //standard input/output header file

#include<conio.h> //for clrscr()

 

int main()

{

int Phy,Chem,Maths,total,per;

 

clrscr(); //for clearing the screen

 

printf(“\n Enter the marks of Physics: “);

scanf(“%d”,&Phy);

printf(“\n Enter the marks of Chemistry: “);

scanf(“%d”,&Chem);

printf(“\n Enter the marks of Math’s: “);

scanf(“%d”,&Maths);

 

total=Phy+Chem+Maths;

per=total/3;

 

printf(“\n Total= %d”,total);

printf(“\n Percentage= %d%”,per);

 

getch(); //holds the screen until any key is pressed

return 0; //makes main() finish

}

 

OUTPUT:

Enter the marks of Physics: 78

Enter the marks of Chemistry: 89

Enter the marks of Math’s: 90

Total= 257

Percentage= 85%