🔒 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
  • 524
    Views
  • 2
    Participants
Last reply from:
Aoshinomori

Trending Topics

Online now

Members online
502
Guests online
1,611
Total visitors
2,113

Forum statistics

Threads
2,293,528
Posts
29,084,549
Members
1,208,831
Latest member
Yokyokieyoks
Back
Top