Welcome to W3Courses

Programming

Try Catch Statements for Error Handling in Asp.Net & C#

Error handling in Classic ASP was not the best. ASP.NET has a new error handling mechanism which was already in other languages such as C, C++ and JAVA. It is called the try...catch mechanism, which is also known as "Exception Handling".

This article provides insight about exception handling on the basis of ASP.NET and C# as code behind.

4.666665
Average: 4.7 (3 votes)

Send Email Attachments from a Form using Asp.Net and C#

In order to send email attachements from a form, we first upload the file to a temporary location on the server. We then attach the file to the email message, execute the mail message to sent he email and finally delete the file from the temporary location.

Please follow the following steps to add attchment funtionality to you Asp.Net form using C#.

3
Average: 3 (2 votes)

Printing Hello World and Numbers From 1 to 11 in C Programming

The following code prints hello world and numbers from 1 to 11

1
Average: 1 (1 vote)

Source Code for Math Functions Sin Cos Tan ArcTan Absolute Value in C Programming

Following is the source code for math functions Absolute Value, Sin, Cos, Tan, and ArcTan:

#include <math.h>
main()
{
        printf("%d %d\n",abs(-4),abs(5));
        printf("%f %f %f\n",sin(1/6.0*M_PI),cos(1/6.0*M_PI),tan(1/6.0*M_PI));
        printf("%f\n",atan(0.5)*180/M_PI);
}

3
Average: 3 (1 vote)

Source Code for Math Functions Log10 Floor Round Power Square Root in C Programming

Following is the source code for math functions Log10, Floor, Round, Power, and Square Root:

#include <math.h>
main()
{
        printf("%f %f\n",log10(64)/log10(2),pow(32,0.2));
        printf("%f %f\n",floor(6.6),rint(6.6));
        printf("%f\n",pow(12,3));
        printf("%f\n",sqrt(25));
}

1
Average: 1 (1 vote)

Source Code for Calculating Factorial of a Number using a For Loop in C Programming

Following is the source code for calculating the factorial of a number using a For Loop in C Programming.

0

Source Code for Calculating Factorial of a Number using a DO WHILE Loop in C Programming

Following is the source code for calculating the factorial of a number using a DO WHILE Loop in C Programming.

main()
{
  int a,b,i;
  printf("Enter a number between 0 and 33: ");
  scanf("%d",&i);
  b=1;
  a=1;
  if(i>=1)
  do
  { b*=a;
    a++;
  }while(a<=i);
   printf("%d\n",b);
}

5
Average: 5 (1 vote)

Source Code for Calculating Factorial of a Number using a Recursive Function in C Programming

Following is the source code for calculating the factorial of a number using a Recursive Function in C Programming.

int f(int n)
{
  if (n==0)
    return 1;
  if (n>0)
    return n*f(n-1);
}
main()
{
  int n;
  printf("Enter a number between 0 and 33: ");
  scanf("%d",&n);
  printf("%d\n",f(n));
}

0

Source Code for Calculating Factorial of a Number using a WHILE Loop in C Programming

Following is the source code for calculating the factorial of a number using a WHILE Loop in C Programming.

main()
{
  int a,b;
  printf("Enter a number between 0 and 33: ");
  scanf("%d",&a);
  b=1;
  while(a>=1)
   { b*=a;
     a--;
   }
  printf("%d\n",b);
}

0

Source Code to Change any Number in Base 10 to Base 2 or Binary in C Programming

Following source code will change any number in base 10 to base 2 or binary in C Programming.

void printit(int num)
{
 if (num)
 {
  int rem = num%2;
  printit(num/2);
  putchar('0'+rem);
 }
}
main()
{
 int num;
 printf("Enter a number: ");
 scanf("%d", &num);
 printit(num);
 printf(" base 2\n");
}

5
Average: 5 (1 vote)