0
Can someone tell me how to code on c for the area or rectangle in this app and pls give me the errors and correct code of below.
int main() { int maths,english,punjabi,physics,chemistry ; printf ("enter marks of maths "); scanf("%d",&marks ); printf ("enter marks of english \n"); scanf ("%d",&marks ); printf ("enter marks of punjabi \n"); scanf("%d",&marks ); printf ("enter marks of physics \n"); scanf("%d",&marks ); printf ("enter marks of chemistry \n "); scanf("%d",&marks ); int total =maths,english,punjabi,physics,chemistry printf ("marks is : %d" ,marks) ; return 0; }
7 Answers
+ 2
Modified code:
https://code.sololearn.com/cFQcIybZj1UQ/?ref=app
+ 1
C does not allow us to declare variable anywhere apart the top of the function. So remove that line that says
int total = .....
Declare "total" at the top level of the function and use it like
total = "...."
+ 1
In this code, input it correctly in 'scanf' according to the subjects, you total the marks of all the subject then use add operator '+' and then you can print the total marks of subjects.
Hint: Area of rectangle
Input the length of the rectangle
Input the width of the rectangle
Area of the rectangle formula: length * width
+ 1
ANKIT RAJ this is not a platform to give you a readymade code, you can take help from google.
0
Sakshi can u pls write the full code for this area of rectangle for this app
0
#include <stdio.h>
int main() {
int total=45+45+45+45+20 ;
printf ("enter marks of maths ");
scanf("%d",&marks );
printf ("enter marks of english \n");
scanf ("%d",&marks );
printf ("enter marks of punjabi \n");
scanf("%d",&marks );
printf ("enter marks of physics \n");
scanf("%d",&marks );
printf ("enter marks of chemistry \n ");
scanf("%d",&marks );
printf ("total") ;
return 0;
}
Can someone pls correct this đ€code and tell me what's the error
0
Remove comma between and put '+'.....declaration on or not it isn't matter coz c compiler check your code line be4 executing