(1) write a programme to input a year and check whether it's a leap year or not ??
(2) write a programme to input the marks of three subjects and find the percentage and check whether the students have passed it not??
Only need the Input. please help me fast. I need this assignment tommorow only..
NO SLAMMING...!!!!
taniya55555:
good
Answers
Answered by
1
leap yearp
#include <stdio.h>
int main()
{ int year;
printf("Enter a year: "); scanf("%d",&year); if(year%4 == 0) { if( year%100 == 0) { // year is divisible by 400, hence the year is a leap year
if ( year%400 == 0)
printf("%d is a leap year.", year);
else printf("%d is not a leap year.", year); }
else printf("%d is a leap year.", year ); }
else printf("%d is not a leap year.", year);
return 0;
2nd
#include <stdio.h>
int main(void){
int num;
printf("Enter your mark ");
scanf("%d",&num);
printf(" You entered %d", num); // printing outputs
if(num >= 80){
printf(" You got A grade"); // printing outputs
}
else if ( num >=60){ // Note the space between else & if
printf(" You got B grade");
}
else if ( num >=40){
printf(" You got C grade");
}
else if ( num < 40){
printf(" You Failed in this exam");
}
return 0;
}
#include <stdio.h>
int main()
{ int year;
printf("Enter a year: "); scanf("%d",&year); if(year%4 == 0) { if( year%100 == 0) { // year is divisible by 400, hence the year is a leap year
if ( year%400 == 0)
printf("%d is a leap year.", year);
else printf("%d is not a leap year.", year); }
else printf("%d is a leap year.", year ); }
else printf("%d is not a leap year.", year);
return 0;
2nd
#include <stdio.h>
int main(void){
int num;
printf("Enter your mark ");
scanf("%d",&num);
printf(" You entered %d", num); // printing outputs
if(num >= 80){
printf(" You got A grade"); // printing outputs
}
else if ( num >=60){ // Note the space between else & if
printf(" You got B grade");
}
else if ( num >=40){
printf(" You got C grade");
}
else if ( num < 40){
printf(" You Failed in this exam");
}
return 0;
}
Similar questions
Social Sciences,
7 months ago
Chemistry,
7 months ago
English,
1 year ago
Social Sciences,
1 year ago
Biology,
1 year ago
Chemistry,
1 year ago