Complete or Remaining Calculation at Percentage
How to calculate:
Complete or Remaining at Percentage(%)
Complete or Remaining at Percentage(%)
Sometimes for tracking our tutorial or different type of work time length, need to calculate it in percentage (0.00%) at “How much completed or remain!”
1st question arise in your mind that:
“Why we need this type of calculation!”
(Very Good Question! 😊)
Answer be like this: By this type of calculation, very easily we setup our goal or focus by calculation, this much completed or remain & by this we boost our working process.
For very beginner its little bit complicated, so for considering those, I try to represent that calculation as much as simple way or represent multiple situation in a simple way!
For this kind of program I use “C Programming Language”
But you can implement this logic at your other favorable language too.
For this kind of calculation, I assume that – we have 5 Hour’s 30 Minute’s tutorial, its mean in minute we have total ((5*60) + 30) "330 minutes"
I’m going to represent 4 type of computational calculation or if you have more suggestion for this kind of calculation, then please feel free to comment me, I try my best to re-programmed your suggestion! 😊
=================================================================================
=================================================================================
- Calculate How much - complete ( in Minutes )
- Calculate How much - complete & remaining also ( in Minutes )
- Calculate How much - complete ( in Hours & Minutes )
- Calculate How much - complete & remaining also (in Hours & Minutes )
1. Calculate How much - complete ( in Minutes )
Source Code :
# include <stdio.h> void main() { float complete , input , total = 330; // in minutes printf("\nTotal time in minutes (%.f)\n\n" , total); printf("Your Watching Minutes : "); scanf("%f", &input); // main calculation happening here complete = ( input / total ) * 100 ; printf("\nYour Total Completed : %.2f%%\n" , complete ); }
Example - 1 |
Example - 2 |
==================================================================================
2. Calculate How much - complete & remaining also ( in Minutes )
Source Code :
# include <stdio.h> void main() { float complete , input , remaining , total = 330; // in minutes printf("\nTotal time in minutes (%.f)\n\n" , total); printf("Your Watching Minutes : "); scanf("%f", &input); // main calculation happening here complete = ( input / total ) * 100 ; remaining = 100 - complete ; printf("\nYour Total Completed : %.2f%%\n" , complete ); printf("\nYour Total Remaining : %.2f%%\n" , remaining ); }
Example - 1 |
Example - 2 |
==================================================================================
3. Calculate How much - complete ( in Hours & Minutes )
Source Code :
# include <stdio.h> void main() { float complete , total_input , inputH , inputM , total = 330; printf("\nTotal time is 5H & 30M\n\n") ; printf("Watching in Hours : "); scanf("%f", &inputH); printf("& Watching in Minutes : "); scanf("%f", &inputM); // covert in minutes inputH = inputH * 60 ; total_input = inputH + inputM ; complete = ( total_input / total ) * 100 ; printf("\nTotal Completed : %.2f%%\n" , complete ); }
Example - 1 |
Example - 2 |
==================================================================================
4. Calculate How much - complete & remaining also ( in Hours & Minutes )
Source Code :
#include <stdio.h> void main() { float complete , remaining , input_time , inputH , inputM , remain_time , remain_hours , remain_minutes , total = 330 ; printf("\nTotal time is 5H & 30M\n\n"); printf("Watching in Hours : "); scanf("%f", &inputH); printf("& Watching in Minutes : "); scanf("%f", &inputM); input_time = ( inputH * 60 ) + inputM ; remain_time = total - input_time ; remain_hours = remain_time / 60 ; remain_minutes = (int)remain_time % 60 ; complete = ( input_time / total ) * 100 ; remaining = 100 - complete ; printf("\nTotal completed : %.2f%%\n" , complete ); printf("\nTotal remaining : %.2f%%\n" , remaining ); printf("\nRemaining Time is : %.0fH %.0fM \n" , remain_hours, remain_minutes ); }
Example - 1 |
Example - 2 |
==================================================================================
Thanks For reading this article too patiently!
Hope this article helpful for You!
😊
==================================================================================
==================================================================================
No comments