If we write more than one statment in if condition then definitely we have to use { } braces. If we write only one statment then it is optional to use {} braces.
1st Assignment Check this bro and reply to me if any mistakes in below code! int main() { // sides of a triangle are a, b, c int a = 45, b = 30, c = 45;
if((a == b)&&(b == c)){ printf("It is an equilateral"); }else if((a == b)|| (b == c) || (a == c)){ printf("It is an Isosceles triangle"); }else{ printf("It is a Scalene triangle"); }
This video is also completed bro.. Tomorrow i will start the loops bro.. I will take the coding challenges on the control statements.and tomorrow i will see the for loops recordings
📢 Assignment || 09th Feb ||🔥 If - else 🔥 1 ✅. Check if a triangle is equilateral, scalene, or isosceles 🔥write code to find the type of the triangle for given side values by using “==” and “&&” operator and If - else Print “Equilateral triangle.” if values for all side1, side2 and side3 are equal. Print “Isosceles triangle.” if values for side1 is equal to side2 or side2 is equal to side3 Else “Scalene triangle.” since values of all sides are unequal. 2 ✅. Find check if a year is leap year or not 🔥 If year is divisble by 4 and not divisble by 100 then print “leap year”. 🔥 Or if year is divisible by 400 then print “leap year”. 🔥 Else print “not a leap year”. 3 ✅ Write a program that calculates a discount based on the purchase amount.Prices equal or over 100 discount have a discount of 20. Prices equal or over 50 have a discount of 10. Otherwise discount is 0 4 ✅ Write a program that calculates the Body Mass Index (BMI) and categorizes it. The formula for BMI is: weight / (height * height).
If we write more than one statment in if condition then definitely we have to use { } braces.
If we write only one statment then it is optional to use {} braces.
3rd Assignment about discount
check it bro I have doubt on this.
int main() {
int a = 30;
float x = a*20/100;
float y = a*10/100;
//
if(a>=100){
printf("%f is discount amount for product more than 100Rs
",x);
}else if(a>=50){
printf("%f is discount amount for product above 50Rs ",y);
}else{
printf("You dont have discount on products");
}
return 0;
}
To find Equilateral triangle
int main() {
// sides of a triangle are a, b, c
int a = 60;
int b = 60;
int c = 60;
if((a == b)&&(b == c)){
printf("It is an equilateral");
}else{
printf("It is not an equilateral");
}
return 0;
}
note:using only if[5th feb assignment]
#include
int main(){
int a=10;
if(a%2==0)
printf("%d is even", a);
if(a%2!=0)
printf("%d is odd", a);
}
#include
int main(){
float a=767.77;
float res= fmod(a ,1);
if(res==0)
printf("not a decimal");
if(res!=0)
printf("is a decimal");
}
#include
int main(){
int a=10;
int b=20;
if(a>b)
printf("a is big");
if(b>a)
printf("b is big");
}
#include
int main(){
int a=10,b=5,c=3;
if(a>b&&a>c)
printf("a is big");
if(b>a&&b>c)
printf("b is big");
if(c>a&&c>b)
printf("c is big");
}
30th january assignment
#include
int main(){
float farenheit,celsius;
printf("enter temperature
");
scanf("%f", &farenheit);
celsius=(farenheit-32)*5/9;
printf("%.2f celsius is equal to %.2f farenheit" ,celsius,farenheit);
}
#include
int main(){
int radii;
float PI=3.14;
int radius=2;
float area;
radii=radius*radius;
area=PI*radii;
printf("area of circle=%f" ,area);
}
#include
int main(){
int res1,res2;
int a=3,b=2;
res1=(a+b)*(a+b)*(a+b);
res2=(a*a*a)+(b*b*b)+3*(a*a)*b+3*(b*b)*a;
printf("res1=%d , res2=%d" ,res1,res2);
}
#include
#include
int main(){
float pri=1000 ,rate=5,time=2;
float amount,CI;
amount=pri*((pow((1+rate/100),time)));
CI=amount-pri;
printf("Intrest=%.2f" ,CI);
}
#include
int main(){
int te=99,hi=98,en=100,ma=90,sc=85,so=80;
int sum=te+hi+en+ma+sc+so;
float per;
printf("sum=%d
" ,sum);
per=sum/6;
printf("percentage=%f" ,per);
}
(by usibg if-else)9th feb assignment
#include
int main(){
int s1,s2,s3;
printf("enter side1:
");
scanf("%d" ,&s1);
printf("enter side2:
");
scanf("%d" ,&s2);
printf("enter side3:
");
scanf("%d" ,&s3);
if(s1==s2&&s2==s3)
printf("equilateral
");
else if(s1==s2||s2==s3||s1==s3)
printf("isosceles
");
else
printf("scalene");
}
#include
int main(){
int year;
printf("enter year:
");
scanf("%d" ,&year);
if((year%4==0 && year%100!=0) ||(year%400==0))
printf("%d is leap", year);
else
printf("%d is not leap", year);
}
#include
int main(){
float BMI;
float weight=50;
float height=80;
BMI=weight/(height*height);
printf("BMI=%f", BMI);
}
#include
int main(){
float p=5000;
float t=2;
float r=5;
float SI;
SI=p*t*r/100;;
printf("Simple intrest=%f", SI);
}
#include
int main(){
float C=95,html=100,css=100,C++=90;
float sum=C+html+css+C++;
float average;
printf("sum=%f
" ,sum);
average=sum/4;
printf("average=%f
" ,average);
if(average>=70)
printf("topper
");
else if(average>=6o)
printf("1st class
");
else if(average>=50)
printf("2nd class
");
else
printf("fail");
}
#include
int main(){
float purchaseAmount=150;
float discount=0;
if(purchaseAmount>=100){
discount=20;
}
else if(purchaseAmount>=50){
discount=10;
}
else
discount=0;
printf("discount:%.2f%%
", discount);
}
I did submit all the assignment questions on the conditional statements through this comment sir.
very good || keep doing practice in the same way until you get a job
@@svgie2047 ok bro
2nd Assignment about Leap Year
int main() {
int y;
y = 5600;
if((y % 4) == 0 && (y % 100) != 0 || (y % 400)==0){
printf("Leap year");
}else{
printf("Not a Leap year");
}
return 0;
}
1st Assignment
Check this bro and reply to me if any mistakes in below code!
int main() {
// sides of a triangle are a, b, c
int a = 45, b = 30, c = 45;
if((a == b)&&(b == c)){
printf("It is an equilateral");
}else if((a == b)|| (b == c) || (a == c)){
printf("It is an Isosceles triangle");
}else{
printf("It is a Scalene triangle");
}
return 0;
}
Helpful
This video is also completed bro..
Tomorrow i will start the loops bro..
I will take the coding challenges on the control statements.and tomorrow i will see the for loops recordings
Good 👍
bro assignments ni post cheyandi
📢 Assignment || 09th Feb ||🔥 If - else 🔥
1 ✅. Check if a triangle is equilateral, scalene, or isosceles
🔥write code to find the type of the triangle for given side values by using “==” and “&&” operator and If - else
Print “Equilateral triangle.” if values for all side1, side2 and side3 are equal.
Print “Isosceles triangle.” if values for side1 is equal to side2 or side2 is equal to side3
Else “Scalene triangle.” since values of all sides are unequal.
2 ✅. Find check if a year is leap year or not
🔥 If year is divisble by 4 and not divisble by 100 then print “leap year”.
🔥 Or if year is divisible by 400 then print “leap year”.
🔥 Else print “not a leap year”.
3 ✅ Write a program that calculates a discount based on the purchase amount.Prices equal or over 100 discount have a discount of 20. Prices equal or over 50 have a discount of 10. Otherwise discount is 0
4 ✅ Write a program that calculates the Body Mass Index (BMI) and categorizes it. The formula for BMI is: weight / (height * height).
Hi sir, you told you'll send some question to practice but you didn't send in previous video and not even in community tab....
done || www.youtube.com/@svgie2047/community
IT is also working bro