How to reduce Animation duration dynamically in c# script

i want to reduce animation duration in c# script, means if a animation on gameobject is completed in 2 sec than on a click it will completed in 1sec.
thanks
kindly response quick.

You can use AnimationState.speed property to increase animation’s speed.

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
    void Example() {
        animation["Walk"].speed = 2;
    }
}