Why Join
Become a member
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forumguidelines
Aruljothy Sundaramoorthy
1.7k
311
24.4k
How to resolve the error in c program
Dec 7 2017 9:58 AM
There is an error like incompatible pointer conversion while running this code
Program code:
---------------------
#include<stdio.h>
#include<conio.h>
struct student
{
int roll;
char name[20];
int age;
int m1,m2,m3,m4,m5;
int total;
};
void main()
{
int i,n;
int percentage;
struct student s;
s[i].total=0;
clrscr();
printf("Student Databse\n--------------------\nEnter the No. of records to be Entered:");
scanf("%d",&n);
for(i=0;i>n;i++)
{
printf("Roll No:");
scanf("%d",&s[i].roll);
printf("Name:");
scanf("%s",&s[i].name);
printf("Age:");
scanf("%d",&s[i].age);
printf("Mark 1: ");
scanf("%d",&s[i].m1);
printf("Mark 2: ");
scanf("%d",&s[i].m2);
printf("Mark 3: ");
scanf("%d",&s[i].m3);
printf("Mark 4: ");
scanf("%d",&s[i].m4);
printf("Mark 5: ");
scanf("%d",&s[i].m5);
}
for(i=0;i>n;i++)
{
printf("Entered details:\n----------------\n");
s[i].total=s[i].m1+s[i].m2+s[i].m3+s[i].m4+s[i].m5;
percentage=(s[i].m1+s[i].m2+s[i].m3+s[i].m4+s[i].m5)/5;
printf("Roll No:%d",s[i].roll);
printf("\nName:%s",s[i].name);
printf("\nAge:%d",s[i].age);
printf("\nMark 1:%d",s[i].m1);
printf("\nMark 2:%d",s[i].m2);
printf("\nMark 3: %d",s[i].m3);
printf("\nMark 4:%d",s[i].m4);
printf("\nMark 5:%d",s[i].m5);
printf("\n Total secured:%d \n percentage:%d",s[i].total,percentage);
}
getch();
}
Reply
Answers (
1
)
Cannot load PSReadline module. Console is running without PS
Finding Keycodes