I want to show Components in a tabs , so first of all create few components. In this project we have three components, First View Component public class AllViewComponent : ViewComponent { private readonly UserManager<ApplicationUser> _userManager; public AllViewComponent(UserManager<ApplicationUser> userManager) { _userManager = userManager; } public async Task<IViewComponentResult> InvokeAsync() { List<StudentViewModel> allUsers = new List<StudentViewModel>(); var items = await _userManager.Users.ToListAsync(); foreach (var item in items) { allUsers.Add(new StudentViewModel {Id=item.Id, EnrollmentNo = item.EnrollmentNo, FatherName = item.FatherName, Name = item.Name, Age = item.Age, Birthdate = item.Birthdate, Address = item.Address, Gender = item.Gender, Email = item.Email }); }
Before writing the program let us see "What is a leap year?"
Definition: A year which satisfies one of the following two cases:
Definition: A year which satisfies one of the following two cases:
- It is divisible by 4 and should not be divisibly by 100
- Divisible by 400
If one of the condition is true, it is a leap year. But, if both condition are false, the year is not a leap year. The following table shows whether a year is a leap year or not along with the reasons:
The partial code for this can be written as follows:
if(year % 4 == 0 && year % 100 !=0) || (year % 400 == 0)
printf ("%d is a leap year \n",year);
else
printf("%d is not a leap year \n");
#include<stdio.h>
void main( )
{
int year;
printf("Enter the year");
scanf("%d",&year);
if((year %4==0 && year %100!=0 ) !! (year %400 == 0))
printf("%d is a leap year ",year);
else
printf("%d is not a leap year",year);
}
else
printf("%d is not a leap year \n");
The complete program is shown below:
Program#include<stdio.h>
void main( )
{
int year;
printf("Enter the year");
scanf("%d",&year);
if((year %4==0 && year %100!=0 ) !! (year %400 == 0))
printf("%d is a leap year ",year);
else
printf("%d is not a leap year",year);
}
Comments
Post a Comment