You are on page 1of 5

ATM OPERATOR

#include<stdio.h>
void displaymenu(){
printf("\nWelcome to SBI ATM");
printf("\n1. Check Balance");
printf("\n2. Deposit");
printf("\n3. Withdraw");
printf("\n4.Exit");
}
void checkbalance(float balance){
printf("Your balance is :%f", balance);
}
float deposit(float balance){
float amount;
printf("Enter your deposit amount :");
scanf("%f", &amount);
if(amount<0){
printf("Invalid Deposit amount");
}else{
balance=balance+amount;
printf("Deposit Succesfully.\nYour new balance :%f", balance);

}
return balance;
}
float withdraw(float balance){
float amount;
printf("Enter your withdraw amount :");
scanf("%f", &amount);
if(amount<0||amount>balance){
printf("Invalid amount");
}else{
balance=balance-amount;
printf("Withdraw succesfully.\nYour new balance :%f", balance);
}
return balance;
}
int main(){
float balance=2000.0;
int choice;
do{
displaymenu();
printf("Enter your choice (1-4):");
scanf("%d", &choice);
switch(choice)
{
case 1:
checkbalance(balance);
break;
case 2:
deposit(balance);
break;
case 3:
withdraw(balance);
break;
case 4:
printf("Thank you for using ATM");
break;
default:
printf("Invalid choice\n");
}

} while (choice !=4);

return 0;
}

BIGGEST OF 3 NUMBER

#include<stdio.h>
int main(){
int a,b,c;
printf("Enter three integers :");
scanf("%d %d %d", &a ,&b ,&c);
if(a>b && a>c){
printf("The biggest number is :%d", a);
}
if(b>a && b>c){
printf("The biggest number is :%d", b);
}
if(c>a && c>b){
printf("The biggest number is :%d", c);
}
return 0;
}
BMI CALCULATION
#include<stdio.h>
int main(){
float bmi[4][2];
int i;
for(i=0;i<=3;i++){
printf("Enter the weight of person (in Kg) :");
scanf("%f", &bmi[i][0]);
printf("Enter the height of person (in meter) :");
scanf("%f", &bmi[i][1]);
}
for(i=0;i<=3;i++){
printf("\n\nBMI of a person :%f", bmi[i][1]/bmi[i][0]*bmi[i][0]);
}
return 0;
}

MARK CUT OFF


#include<stdio.h>
int main()
{
int p,c,m,b;
float eng_cutoff,med_cutoff;
printf("Enter the mark of Physics :");
scanf("%d", &p);
printf("Enter the mark of Chemistry :");
scanf("%d", &c);
printf("Enter the mark of Maths :");
scanf("%d", &m);
printf("Enter the mark of Biology :");
scanf("%d", &b);
eng_cutoff=(p+c+m)/3;
med_cutoff=(p+c+b)/3;
printf("\n\nEngineering cut_off marks :%f", eng_cutoff);
printf("\n\nMedical cut_off marks :%f", med_cutoff);
return 0;

}
MINIMUM AND MAXIMUN
#include <stdio.h>
#include <stdlib.h>
int main() {
int a[10],i;
printf("\nEnter the the 10 sales and buy value throughout the day :");
for(i=0;i<10;i++)
{
scanf("%d",&a[i]);
}
int key, j;
for (i = 1; i < 10; i++)
{
key = a[i];
j = i - 1;
while (j >= 0 && a[j] > key)
{
a[j + 1] = a[j];
j = j - 1;
}
a[j + 1] = key;
}
printf("\n the best buy price %d",a[0]);
printf("\n the best sell price %d",a[9]);
return 0;
}

ODD OR EVEN
#include<stdio.h>
int main(){
int a;
printf("Enter the integer :");
scanf("%d", &a);
if(a%2==0){
printf("Integer is even :%d", a);
}else{
printf("Integer is odd :%d", a);
}
return 0;
}
POSITIVE OR NEGATIVE INTEGER
#include<stdio.h>
int main(){
int a;
printf("Enter the integer :");
scanf("%d", &a);
if(a<=0 || a==0){
printf("You enter 0 or Negative integer");
}else{
printf("It is positive integer");
}
return 0;
}

PREVIOUS TWO ELEMENT


#include<stdio.h>
int main(){
int arr[100],size,i,sum=0,flag=1;
printf("\nEnter the number of students in line :");
scanf("%d", &size);
printf("\nEnter the array element :");
for(i=0;i<size;i++){
scanf("%d", &arr[i]);
}
for(i=2;i<size;i++){
if(arr[i]==arr[i-2]+arr[i-1]){
printf("Yes. Element of indes at %d is the sum of previous two
element", i);
}else{
printf("No.Element is not the sum of previous two element");
}
}
return 0;
}

You might also like