🔒 Closed Patulong po!!

Status
Not open for further replies.
mga ka ph dyan na magagaling sa c language program paturo naman po ng code>
for educational purposes lang po ito mga bossing..

bale ganito po yung output ng program:

1.additional
2.subtraction
3.multiplication
4.division

select:


tapos pagpinindot po yung
nasa selection above po

automatic po random ang
mga digit po and then mag aask po ng
posible result yung program,

if mali po yung eneter mo na result program say's "Wrong"
kung tama naman po "CORRECT"

thanks po sa tulong mga IDOL!!
 
#include<stdio.h>
#include<conio.h>
main()
{
clrscr();
float a,b,sum,sub,mul,div;
char operation;
printf("Enter first number:");
scanf("%f",&a);
printf("Enter second number:");
scanf("%f",&b);
printf("\nMENU\n");
printf("a. Addition\n");
printf("s. Subtraction\n");
printf("m. Multiplication\n");
printf("d. Division\n");
printf("Press the correct letter to the corresponding operation:");
do
{
operation=getchar();
}
while(operation!='a' && operation!='s' && operation!='m' && operation!='d');
switch(operation)
{
case 'a':
{
sum=a+b;
printf("The answer is:%.2f",sum);
break;
}
case 's':
{
sub=a-b;
printf("The answer is:%.2f",sub);
break;
}
case 'm':
{
mul=a*b;
printf("The answer is:%.2f",mul);
}
break;
case 'd':
{
div=a/b;
printf("The answer is:%.2f",div);
}
break;
default:
{
printf("Error! operator is not correct");
break;
}
}
getch();
return 0;
}

sana nakatulong
 
try sana makatulong


Code:
#include<iostream>


using namespace std;

int main()
{
    int total=4,cho;
   
    loop:
    cout<<"\nChoices\n";
    cout<<"\n1.  +";
    cout<<"\n2.  -";
    cout<<"\n3.  *";
    cout<<"\n4.  /";
    cout<<"\n\nChoice:";
    cin>>cho;
   
   
   
        switch(cho)
   
    {
   
        case 1:
        {
           
            total=total+4;
            cout<<"\nTotal: " <<total;
            if(total = total)
           
            goto loop;
           
        break;
        }
       
        case 2:
        {
            total=total-4;
            cout<<"\nTotal: " <<total;
            if(total = total)
           
            goto loop;
           
        break;
        }
        case 3:
        {
           
            total=total*4;
            cout<<"\nTotal: " <<total;
            if(total = total)
           
            goto loop;
           
        break;
        }
       
        case 4:
        {
            total=total/4;
            cout<<"\nTotal: " <<total;
            if(total = total)
           
            goto loop;
           
        break;
        }
       
   
       
    }
   

    cout<<"\n\n";
   
   
    system("pause");
    return 0;
}
 
Dear ™jamon111996™,

Since 2 years have passed since the last reply in this thread, I am locking it to prevent necroposting. Feel free to start a new thread or contact any forum staff if you want this to be reopened.

Thread closed.
 
Status
Not open for further replies.

About this Thread

  • 7
    Replies
  • 1K
    Views
  • 5
    Participants
Last reply from:
Unknown user

Trending Topics

Online now

Members online
1,086
Guests online
5,241
Total visitors
6,327

Forum statistics

Threads
2,338,498
Posts
29,304,359
Members
1,124,325
Latest member
sziazevi
Back
Top