🔒 Closed C language po pa help

Status
Not open for further replies.
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
  • 533
    Views
  • 2
    Participants
Last reply from:
Aoshinomori

Trending Topics

Online now

Members online
461
Guests online
2,241
Total visitors
2,702

Forum statistics

Threads
2,331,976
Posts
29,261,528
Members
1,147,959
Latest member
v69
Back
Top