0% found this document useful (0 votes)
6 views

Programming Final

Uploaded by

nmr69gaming
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Programming Final

Uploaded by

nmr69gaming
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Answer to the question no - 1

#include<stdio.h>

int main(){
int side1, side2, side3;

printf("Enter sides of triangle: ");


scanf("%d%d%d",&side1,&side2,&side3);

if(side1 == side2 && side2 == side3)


printf("The Given Triangle is equilateral");
else if(side1 == side2 || side2 == side3 || side3 == side1)
printf("The given Triangle is isosceles");
else
printf("The given Triangle is scalene");

return 0;
}

Answer to the question no - 2

#include<stdio.h>

int main(){
int marks;
char grade;

printf("Enter marks: ");


scanf("%d",&marks);

if(marks >= 80 && marks <= 100){


grade = 'A';
}else if(marks >= 60 && marks < 80){
grade = 'B';
}else if(marks >= 50 && marks < 60){
grade = 'C';
}else{
grade = 'D';
}
printf("Grade: %c\n",grade);

if(marks > 90){


printf("Congratulations! You are eligible for Scholarship.");
}else{
printf("Sorry, you are not eligible for Scholarship.");
}

return 0;
}

Answer to the question no - 3

#include<stdio.h>

int main()
{
int value;
float result;
printf("Enter the value : ");
scanf("%d",&value);
if(value>0)
{
if(value%2==0)
{
result = value * 5.0;
printf("Result = %.2f",result);
}
else
{
result = (float)value/5;
printf("Result = %.2f",result);
}
}
else
{
printf("Result = %d",value);
}
return 0;
}
Answer to the question no - 4

#include <stdio.h>

int main() {
int year = 2024;

int leap_year = 0;

if (year % 2 == 0) {
if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) {

leap_year = 1;
}
}

printf("The year %d is a leap year: %s\n", year, leap_year ? "yes" : "no");


return 0;
}

You might also like