🔒 Closed C language po pa help

Status
Not open for further replies.

zacha

Forum Veteran
1653406631493.webp
 
C:
#include <stdio.h>
#include <ctype.h>

void main()
{
    float length, width;
    char choice;

    do
    {
        printf("Enter length: ");
        scanf("%f", &length);
        printf("Enter width: ");
        scanf("%f", &width);
        printf("Perimeter = %f", (2*length) + (2*width));
        printf("\nWould you like to try again? [y/n]: ");
        scanf(" %c", &choice);
        choice = toupper(choice);

    }while (choice== 'Y');

Yung pangatlong scanf meron talagang space after ng open double quote. It's a workaround sa character input.
 
Status
Not open for further replies.

About this Thread

  • 5
    Replies
  • 521
    Views
  • 2
    Participants
Last reply from:
Aoshinomori

Online now

Members online
647
Guests online
909
Total visitors
1,556

Forum statistics

Threads
2,277,904
Posts
28,979,570
Members
1,229,144
Latest member
Karisma18
Back
Top