Sunday, 7 January 2018

Learn C language Part 30 Gets and Puts String Method in C





#include <stdio.h>

#include <conio.h>



main()

{



char name[50];

printf("Enter your Name: ");

gets(name); //read string...



printf("Your Name is : ");

puts(name); //print .....



}

Learn C language Part 29 Read String From Use Input using while loop





#include <stdio.h>

#include <conio.h>



main()

{



char name[50];

char c;

int i=0;

printf("Enter your Name: ");



while(c!='\n')

{



c=getchar();

name[i]=c;

i++;



}



name[i]='\0';





printf("name : %s",name);







}

Friday, 5 January 2018

How to Check input is Alphabet or not





#include <stdio.h>

#include <conio.h>



main()

{



char c;

printf("Enter a character: ");

scanf("%c",&c);





if((c>='a'&& c<='z') || (c>='A'&& c<='Z')  )

{

printf("%c is an alphabet",c);



}

else

{

printf("%c is not an alphabet",c);



}











}

How to Find a year is a leap year





#include <stdio.h>

#include <conio.h>



main()

{



int year;



printf("Enter the year: ");

scanf("%d",&year);



if(year%4==0)

{



printf("%d is a leap year",year);

}



else

{

printf("%d is a not leap year",year);



}















}

How to Check a number is Even or Odd



#include <stdio.h>

#include <conio.h>





main()

{

int n;



printf("ENTER A NUMBER: ");

scanf("%d",&n);



if(n%2==0)

{

printf("%d is an even number",n);

}



else

{

printf("%d is an Odd number",n);



}







}



//2,4,6,8,10,....even

//1,3,5,7,9...... odd


Thursday, 4 January 2018

Learn C language Part 28 String Introduction in C Language



#include <stdio.h>

#include <conio.h>



main()

{



char c[]="abcd\\ndef";

char d[4]="abc";



char e[] = {'a', 'b', 'c', 'd', '\0'};

     OR,

char f[5] = {'a', 'b', 'c', 'd', '\0'};



printf("%s",&c);



printf("\n%s",&d);







}


Learn C language Part 27 Function by reference





#include <stdio.h>

#include <conio.h>



void calculator(float a,float b,float *plus,float *diff, float *product, float *divide);



main()

{



float add,sub,mul,div;

float a=32.1, b=10.9;

calculator(a,b,&add,&sub,&mul,&div);



printf("Sum = %f\n",add);

printf("Difference = %f \n",sub);

printf("Product = %f \n",mul);

printf("quotient = %f \n",div);









}



void calculator(float a,float b,float *plus,float *diff, float *product, float *divide)

{

*plus= a+b;

*diff= a -b;

*product=a*b;

*divide=a/b;



}


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 ...