Tuesday 12 December 2017

Learn C language Part 5 goto unconditional jump stattements with marksheet program

#include<stdio.h>
#include<conio.h>

main()
{

int eng,math,phy,urdu,islamiat;
float percentage;
l1:
printf("Enter the marks obtained in English: ");
scanf("%d",&eng);

if(eng<0)
{
printf("\nInvalid input !obtained Marks cannot be negative\n\n");
goto l1;
}


l2:
printf("\nEnter the marks obtained in Mathematics: ");
scanf("%d",&math);


if(math<0)
{
printf("\nInvalid input !obtained Marks cannot be negative\n\n");
goto l2;
}



l3:
printf("\nEnter the marks obtained in Physics: ");
scanf("%d",&phy);
if(phy<0)
{
printf("\nInvalid input !obtained Marks cannot be negative\n\n");
goto l3;
}



l4:

printf("\nEnter the marks obtained in Urdu: ");
scanf("%d",&urdu);

if(urdu<0)
{
printf("\nInvalid input !obtained Marks cannot be negative\n\n");
goto l4;
}




l5:
printf("\nEnter the marks obtained in Islamiat: ");
scanf("%d",&islamiat);
if(islamiat<0)
{
printf("\nInvalid input !obtained Marks cannot be negative\n\n");
goto l5;
}





percentage= ((eng+math+phy+urdu+islamiat)*100/500);

printf("Percentage: %.2f",percentage);

printf("\n\n\n Grade:");
if(percentage>=80)
{
printf("A+");

}
else if(percentage>=70)
{
printf("A");
}
else if(percentage>=60)
{
printf("B");
}
else if(percentage>=50)
{
printf("C");
}
else
{
printf("F");

}





}

Learn C language Part -4 if else ,ladder if else, nested if else statements with practical example

#include <stdio.h>
#include <conio.h>

main()
{

int age;

printf("Enter your age: ");
scanf("%d",&age);

if(age>=18)
{
// printf("YOU ARE ELIGIBLE FOR THIS JOB......");
if(age<=20)
{
printf("YOU ARE ELIGIBLE FOR clerk JOB......");
}

else if(age<=25)
{

printf("YOU ARE ELIGIBLE FOR HR JOB......");
}

else if(age<=30)
{

printf("YOU ARE ELIGIBLE FOR manager JOB......");
}
else
{
printf("age limit exceeded!......");
}


}


else
{
printf("YOU ARE NOT ELIGIBLE FOR THIS JOB......");
}







}

Pass Dynamically Added Html Table Records List To Controller In Asp.net MVC

Controller Code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ...