5) Write a function to determine is a given word is legal. A word is illegal if
ID: 3758365 • Letter: 5
Question
5) Write a function to determine is a given word is legal. A word is illegal if it contains no vowels. For this problem,
the letter Y is considered to be a legal vowel. Pass in a word to this function and it will determine if the word is
legal or not. You can make the following assumptions about the word you a passing to this function.
1) The string being passed is a combination of letters only (no non-letter check needed)
2) The string being passed is null terminated
3) Letters may be capital or lower case and it has no effect on whether its a word
Examples:
sch - is illegal, no vowels
apple - legal, contains a vowel
APPle - legal, uppercase letter combinations do not matter
try - legal, no vowel, but contains the letter 'y'
Explanation / Answer
Solution :
1) a) //Program to find out the area of circle by using macro
#include<stdio.h>
#include<conio.h>
#define pi 3.1416//macro
int main()
{
float area, radius;
clrscr();
printf("Enter the radius of circle whose area to be calculated ");
scanf("%f",&radius);
area=pi*radius*radius;
printf(" The Area of the Circle is = %f",area);
getch();
return 0;
}
b)
#include<conio.h>
#include<stdio.h>
#define number(n) n*n
void main()
{
int result = 0, num = 0;
clrscr();
scanf("%d", &num);
result = number(num);
printf("%d", &result);
getch();
}
c)
d)
#include<stdio.h>
#include<math.h>
int main(){
float a,b,c;
float s,area;
printf("Enter size of each sides of triangle");
scanf("%f%f%f",&a,&b,&c);
s = (a+b+c)/2;
area = sqrt(s*(s-a)*(s-b)*(s-c));
printf("Area of triangle is: %.3f",area);
return 0;
}
2)
3)
4)
5)
6)
7) 1)
2) and 3)
4)
5)
6)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.