Program in C to enter records

Write a program to enter records and also repeat the step if user wants to continue

#include <stdio.h>

void main ()
{
            char nm [20],cls[10];
            int rollno,m1,m2,m3,tm;
            float per;
            char ch;
            clrscr ();
            do
            {
                        printf ("\nEnter Marks of Hindi: ");
                        scanf ("%d",&m1);
                        printf ("Enter Marks of Pbi : ");
                        scanf ("%d",&m2);
                        printf ("Enter Marks of Math : ");
                        scanf ("%d",&m3);
                        tm=m1+m2+m3;
                        per=(tm*100)/300;
                        printf ("\nTotal Marks are %d",tm);
                        printf ("\nPercentage is %.2f",per);
                        printf ("\nDo you want to continue Y/N: ");
                        fflush(stdin);
                        scanf ("%c",&ch);
            }
            while (ch=='y' || ch=='Y');
            getch ();
}


Post a Comment