Click here to Skip to main content
14,882,311 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
#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 no tried it please solve it.I shall be very thankful to you.
Posted
Updated 3-Mar-21 19:20pm

All the information you need is at: The Python Tutorial — Python 3.7.9 documentation[^]
   
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[^]
   
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 ...
   
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.
   
v3

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