Sie sind auf Seite 1von 8

Question 6 #include <stdio.

h>
int main()
{
int number;

number = 1;

while (number < 3)


{
printf("\----------------------------------------/ \n");
printf("\\ BBBBB A /\n");
printf("\\ B B A A /\n");
printf("\\ BBBB A A /\n");
printf("\\ B B AAAAAAAA /\n");
printf("\\ BBBBB A A /\n");
printf("\\---------------------------------------/\n\n");
number++;
}
}
#include<stdio.h>
void main(void)
{
int loop = 0, count = 0;

printf("How many times");


scanf("%d", &loop);

while (count < loop)


{
printf("\n)\n--------------");
printf("\n--------------");
printf("\n--------------");
printf("\n--------");
printf("\n--------");
printf("\n--------");
printf("\n--------------");
printf("\n--------------");
count++;
}
printf("\n\n");

}
#include <stdio.h>
int main()
{
char ch;
printf("MY SMILING/ANGRY FACE ");
printf("\nEnter option [S/A]:");
scanf("%c", &ch);

if (ch == 'A' | ch == 'a')


{
printf(" vvvvvvvvvvvvvv");
printf("\n / vvvvvvvvvvvvvvvv\\");
printf("\n | vvvvvvvvvvvv |");
printf("\n | |");
printf("\n | /\\ /\\ |");
printf("\n(| * * |");
printf("\n | | |");
printf("\n \\ \\----/ /");
printf("\n \\ /");
printf("\n \\___________/");
}
else if (ch == 'S' | ch == 's')
{
printf(" vvvvvvvvvvvvvv");
printf("\n / vvvvvvvvvvvvvvvv\\");
printf("\n | vvvvvvvvvvvv |");
printf("\n | |");
printf("\n | /\\ /\\ |");
printf("\n(| * * |");
printf("\n | | |");
printf("\n \\ \\- -/ /");
printf("\n \\ -- /");
printf("\n \\___________/");
}
else
printf("Please enter a valid option [S/A] ");

printf("\nRate this face:");


printf("\nHOW MANY LIKES: ");
scanf("%d", &ch);
printf("The face has %d likes");

return 0;
}
#include <stdio.h>
int main()
{
int loop = 0, count = 0

char ch;
printf("MY SMILING/ANGRY FACE ");
printf("\nEnter option [S/A]:");
scanf("%c", &ch);
printf("How many times: ");
scanf("%d", &loop);

while (count < loop)

if (ch == 'A' | ch == 'a')


{
printf("\tvvvvvvvvvvvvvv\t\t");
printf("\n/\tvvvvvvvvvvvvvvvv\t\\");
printf("\n|\t\t\t\t|");
printf("\n|/\t\ /\ |");
printf("\n\t\----/\t/");
}
else if (ch == 'S' | ch == 's')
{
printf("\tvvvvvvvvvvvvvv\t\t");
printf("\n/\tvvvvvvvvvvvvvvvv\t\\");
printf("\n|\t\t\t\t|");
printf("\n\t\----/\t/");
}
else
printf("Please enter a valid option [S/A] ");

printf("\nRate this face:");


printf("\nHOW MANY LIKES: ");
scanf("%d", &ch);
printf("The face has %d likes");

return 0;
}
#include<stdio.h>
void main(void)
{
int day;

printf("Enter any number between 1 to 7 [or -999 to exit]: ");


for (scanf("%d", &day); day != -999; scanf("%d", &day))
{
switch (day)
{
case 1: printf("\n\nDay 1 is monday"); break;
case 2: printf("\n\nDay 1 is tuesday"); break;
case 3: printf("\n\nDay 1 is wednesday"); break;
case 4: printf("\n\nDay 1 is thursday"); break;
case 5: printf("\n\nDay 1 is friday"); break;
case 6: printf("\n\nDay 1 is saturday"); break;
case 7: printf("\n\nDay 1 is sunday"); break;
default: printf("\n\nWrong input!"); break;
}
printf("\n\nEnter any number between 1 to 7 [or -999 to exit]: ");
}
}
#include<stdio.h>
void main(void)
{
float no1 = 0.0, no2 = 0.0;
char op;

printf("--------------------------------");
printf("\n\t\tBasic Calculator");
printf("\n\tA: Addition");
printf("\n\tS: Subtraction");
printf("\n\tM: Multiplication");
printf("\n\tD: Division");
printf("\n--------------------------------");

printf("\nEnter two real numbers: ");


scanf("%f %f", &no1, &no2);
printf("Select an operation: ");
fflush(stdin);
op = getchar();

switch (op)
{
case 'a':
case 'A':
printf("%.2f + %.2f = %.2f", no1, no2, no1 + no2);
break;
case 's':
case 'S':
printf("%.2f - %.2f = %.2f", no1, no2, no1 - no2);
break;
case 'm':
case 'M':
printf("%.2f x %.2f = %.2f", no1, no2, no1* no2);
break;
case 'd':
case 'D':
printf("%.2f / %.2f = %.2f", no1, no2, no1 / no2);
break;
}

Das könnte Ihnen auch gefallen