Showing posts with label conio.h. Show all posts
Showing posts with label conio.h. Show all posts

Count number of students above,below and average students

Count no. of students above,below and average students

  #include<stdio.h>
  #include<conio.h>
   void main()
    {
     int a[10];
     int aa=0,ba=0,ae=0,i;
     clrscr();
     printf("Enter the marks:\n");
     for(i=0;i<10;i++)
       {
scanf("%d",&a[i]);
if(a[i]>55)
aa++;
else if(a[i]<55)
ba++;
else
ae++;
       }
     printf("No. OF AVG STUDENTS ARE:%d\n",ae);
     printf("No. OF ABOVE AVERAGE STUDENTS:%d\n",aa);
     printf("No. OF BELOW AVERAGE STUDENTS ARE:%d",ba);
    getch();
   }

a demo program which represent the ATM transaction

ATM programing

ATM C programing language Program code

 ‎/*Note Pin code is 1234*/
#include<stdio.h>
#include<conio.h>

void main(void)
{ unsigned long amount=1000,deposit,withdr​aw;
int choice,pin=0,k=0;
char another='y';

while(pin!=1234)
{ clrscr();
gotoxy(30,25);
printf("Enter pin:");
scanf("%d",&pin);
}
clrscr();
do
{

printf("********Welcome to ATM Service**************\n");
printf("1. Check Balance\n");
printf("2. Withdraw Cash\n");
printf("3. Deposit Cash\n");
printf("4. Quit\n");
printf("******************​**************************​*\n\n");
printf("Enter your choice: ");
scanf("%d",&choice);
switch(choice)
{
case 1:
printf("\nYour Balance is Rs : %lu ",amount);
break;
case 2:
printf("\nEnter the amount to withdraw: ");
scanf("%lu",&withdraw);
if(withdraw%100!=0)
{
printf("\nPlease enter

amount in multiples of 100");
}else if(withdraw>(amount-500))
{

printf("\nInsufficient Funds");
}else
{

amount=amount-withdraw;

printf("\n\nPlease collect cash");

printf("\nYour balance is %lu",amount);
}
break;
case 3:
printf("\nEnter amount to deposit");
scanf("%lu",&deposit);
amount=amount+deposit;
printf("Your balance is %lu",amount);
break;
case 4:
printf("\nThank you for using ATM");
break;
default:
printf("\nInvalid Choice");
}
printf("\n\n\nDo you want another transaction?(y/n): ");
fflush(stdin);
scanf("%c",&another);
if(another=='n'||another==​'N')
k=1;
}while(!k);
printf("\n\nHave a nice day");
getch();

}