My Profile
Active Members
TodayLast 7 Days
more...
Awards & Gifts
Online Exams
Fresher Jobs
Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian
cities including Bangalore, Chennai, Hyderabad, Pune or Kochi
Resources
Find educational articles, blogs, discussion threads and other resources.
Colleges
Find details about any college in India or search for courses.
|
C program to calculate student-wise total for three students using an array
Posted Date:
Total Responses: 0
Posted By: Sunil Reddy Member Level: Platinum Points/Cash: 4
|
#include struct marks { int sub1; int sub2; int sub3; int total; }; main() { int i; static struct marks student[3] = { {56, 45, 65}, {59, 55, 75}, {45, 65, 75}}; static struct marks total; for (i = 0; i <= 2; i++) { student[i].total = student[i].sub1 + student[i].sub2 + student[i].sub3; total.sub1 = total.sub1 + student[i].sub1; total.sub2 = total.sub2 + student[i].sub2; total.sub3 = total.sub3 + student[i].sub3; total.total = total.total + student[i].total; } printf(“\nSTUDENT TOTAL\n\n”); for (i = 0; i <= 2; i++) printf(“\nStudent[%d] %d”, i + 1, student[i].total); printf(“\nSUBJECT TOTAL\n\n”); printf(“%s %d\n%s %d\n%s %d\n”, “Subject 1“, total.sub1, “Subject 2“, total.sub2, “Subject 3“, total.sub3); printf(\nGrand Total = %d”,total.total); }
|
Project Feedbacks
|
No feedbacks found. Be the first to respond and make money from revenue sharing program.
|
|
|
| Post Feedback |
|
|
You must Sign In to post a feedback.
|
|
|
|
|
Advertise Here
|