#include <stdio.h>
#define p printf
#define s scanf
int program,Y,N;

do
    {
    p("Choose from the following program\n");
    p("1 for program no.1");
    p("2 for program no.2");
    p("3 for program no.3");
    p("4 for program no.4");
p("Continue (Y or N)?");
repeat = getchar();
putchar('\n');
}while(repeat == 'Y' || repeat == 'N');
}


program1()
main()
{
int day, month;
clrscr();
p("Use number only!!!\n");
p(" 1 - January\n");
p(" 2 - February\n");
p(" 3 - March\n");
p(" 4 - April\n");
p(" 5 - May\n");
p(" 6 - June\n");
p(" 7 - July\n");
p(" 8 - August\n");
p(" 9 - September\n");
p(" 10 - October\n");
p(" 11 - November\n");
p(" 12 - December\n");
p("\nInput month: ");
s("%d", &month);
p("\nInput day: ");
s("%d", &day);

        if (month == 3 && day > 20 || month == 4 && day <=19)
            p("\nYour zodiac sign is Aries!");
        else if(month == 4 && day > 19 || month == 5 && day <=20)
            p("\nYour zodiac sign is Taurus!");
        else if (month == 5 && day > 20 || month == 6 && day <=21)
            p("\nYour zodiac sign is Gemini!");
        else if (month == 6 && day > 21 || month == 7 && day <=22)
            p("\nYour zodiac sign is Cancer!");
        else if (month == 7 && day > 22 || month == 8 && day <=22)
            p("\nYour zodiac sign is Leo!");
        else if (month == 8 && day > 22 || month == 9 && day <=22)
            p("\nYour zodiac sign is Virgo!");
        else if (month == 9 && day > 22 || month == 10 && day <=22)
            p("\nYour zodiac sign is Libra!");
        else if (month == 10 && day > 22 || month == 11 && day <=21)
            p("\nYour zodiac sign is Scorpio!");
        else if (month == 11 && day > 21 || month == 12 && day <=21)
            p("\nYour zodiac sign is Sagittarius!");
        else if (month == 12 && day > 21 || month == 1 && day <=19)
            p("\nYour zodiac sign is Capricorn!");
        else if (month == 1 && day > 19 || month == 2 && day <=18)
            p("\nYour zodiac sign is Aquarius!");
        else if (month == 2 && day > 18 || month == 3 && day <=20)
            p("\nYour zodiac sign is Pisces!");
        else
            p("\nSorry your input is invalid");

getche();
}
program2
float M, AMT, C, L, A, P, EX, ANS;
char place;

{
clrscr();
p("\nChoose a location for a distance call.\n");
p("\nC - Cavite\n");
p("\nL - Laguns\n");
p("\nA - Albay\n");
p("\nP - Palawan\n");
p("\nNote: Type only the capital letter of the location.\n");
s("%c", &place);
p("\nEnter number of minute(s): ");
s("%f", &M);
switch(place)
    {
        case 'C':
            AMT=15;
            if(M>=6)
            EX=M-5;
            ANS=(EX*5)+AMT;
        p("\nThe amount you will pay for this call is:%f", ANS);
            break;
        case 'L':
            AMT=15
            if(M>=6)
            EX=M-5;
            ANS=(EX*6)+AMT;
        p("\nThe amount you will pay for this call is:%f", ANS);
            break;
        case 'A':
            AMT=15
            if(M>=6)
            EX=M-5;
            ANS=(EX*14)+AMT;
        p("\nThe amount you will pay for this call is:%f", ANS);
            break;
        case 'P':
            AMT=15
            if(M>=6)
            EX=M-5;
            ANS=(EX*20)+AMT;
        p("\nThe amount you will pay for this call is:%f", ANS);
            break;
        default:
                p("\nSorry you entered invalid character(s)!");
        }
getche();
}
program3()
int X, K, C, P, T;

{
clrscr();
p("\nEnter the number of person(s): ");
s("%d", &P);
X=P*9;
C=X*9;
K=C*9;
T=(C*4)+(K*4)+(P*2*9);
p("\n\nThe total number of cats:%d", C);
p("\n\nThe total number of kittens:%d", K);
p("\n\nThe total number of legs:%d", T);
getche();
}
program4()
int a,b,c,d,k,x,y;
{
clrscr();
p("\nInpute the value of a: ");
s("%d",&a);
p("\nInput the value of b: ");
s("%d",&b);
p("\nInput the value of c: ");
s("%d",&c);
d= pow(b,2)-(4*a*c);
if(d>=0)
    {
    k= sqrt(d);
    x= (-b+k)/(2*a);
    y= (-b-k)/(2*a);
    p("The quadratic equation %dx^2 + %dx + %d",x,y);
    }
    else
    {
    float re, im;
    d *= -1;
    k= sqrt(d);
    re= -b/(2*a);
    im= k/(2*a);
    p("\nThe quadratic equation is x=%f + (%fi)\n", re, im);
    p("\nThe quadratic equation is x=%f - (%fi)\n", re, im);
    }
getch();
}
Re: here is my program... how to make it as one using do while loop??? pls help me fix it 80 80

You are kidding, where is your code tags?

Re: here is my program... how to make it as one using do while loop??? pls help me fix it 80 80

You are kidding, where is your code tags?

what's the missing in my code pls help me fix it!!

im begging you!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.