Click here to Skip to main content
15,883,873 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Python
#include <stdio.h>
int main()
{
    int theory,practical,totalmarks,internalmarks,exammarks,midexam,finalexam,quiz,assignment;
    printf("enter quiz marks\n");
    scanf("%d", &quiz);
    printf("enter assignment marks\n");
    scanf("%d",&assignment);
    printf("enter mid marks\n");
    scanf("%d",&midexam);
    printf("enter final marks\n");
    scanf("%d",&finalexam);
    printf("enter lab marks\n");
    scanf("%d",&practical);
    internalmarks=quiz+assignment;
    exammarks=midexam+finalexam;
    theory=internalmarks+exammarks;
    totalmarks=theory+practical;
    printf("Asif's total marks for a course is %d",totalmarks);
    return 0;
}


What I have tried:

I have not tried it. Please solve it. I shall be very thankful to you.
Posted
Updated 23-Jun-23 7:47am
v2

This is not a code conversion service: we are not here to translate code for you.
Even if we did, what you would end up with would not be "good code" in the target language – they are based on very different frameworks, and what makes something work in one language does not always "translate" directly into another.
So what you end up with is very poor code, that is difficult if not impossible to maintain, that can’t be upgraded nicely, and that will cause you immense headaches if the original is changed. And it’ll be a nightmare to debug if it doesn’t work "straight out of the box".
Instead, use the source code as a specification for a new app written in and for the target language / framework and write it from scratch using the original as a "template". You will get a much, much better result that will save you a lot of time in the long run.

And to be honest, if you can't write trivial code like that yourself, you really should reconsider your options: fast food is a better career choice than development ...
 
Share this answer
 
All the information you need is at: The Python Tutorial — Python 3.7.9 documentation[^]
 
Share this answer
 
v2
The first line in the main() routine defines numeric variables.
Then text is displayed with the printf() function.
Then it waits for user input with the scanf() function.

This should be enough to get you started!

More information about learning Python here: best-resources-to-learn-python[^]
 
Share this answer
 
v2
The solution 2 person is correct we can help if your need some minute changing or to understand something but we are not a programming language translators. So no we would not help you in this do this on your own.
 
Share this answer
 
Comments
Dave Kreskowiak 23-Jun-23 14:52pm    
Look at the date on the question.
As OriginalGriff said, this is not a coding service. If you want more help at least show what you've tried.

This will do it:
Python
quiz = input('Enter quiz marks: ')
assignment = input('Enter assignment marks: ')
midexam = input('Enter mid marks: ')
finalexam = input('Enter final marks: ')
practical = input('Enter lab marks: ')

internalmarks = int(quiz) + int(assignment)
exammarks = int(midexam) + int(finalexam)
theory = internalmarks + exammarks
totalmarks = theory + int(practical)

print("Asif's total marks for a course is: " + str(totalmarks))

Next time show some effort :).

EDIT: Why the downvotes? Does it not say: "Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question."? Which, I might add, is exactly what the first answer is.
 
Share this answer
 
v3
Comments
Dave Kreskowiak 22-Jun-23 16:27pm    
Why the downvotes? Because you did the OP's homework for them and they learn nothing.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900