arduino analog input pins as PWM outpu

hi can i use arduino UNO analog input pins A0-A5 as PWM output to rotate servo motor?

Although the Uno's pins A0-A5 don't have hardware PWM functionality, you don't need to use PWM pins with the Arduino Servo library. So you are welcome to use those pins.

int led = A0; // the PWM pin the LED is attached to
int brightness = 0; // how bright the LED is
int fadeAmount = 5; // how many points to fade the LED by

// the setup routine runs once when you press reset:
void setup() {
// declare pin 9 to be an output:
pinMode(led, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
// set the brightness of pin 9:
analogWrite(led, brightness);

// change the brightness for next time through the loop:
brightness = brightness + fadeAmount;

// reverse the direction of the fading at the ends of the fade:
if (brightness <= 0 || brightness >= 255) {
fadeAmount = -fadeAmount;
}
// wait for 30 milliseconds to see the dimming effect
delay(30);
}

IF THIS IS MY CODE THEN WILL IT WORK?

You can only use analogWrite() with the pins that have hardware PWM capability. You can't use that function on pins A0 - A5 on your Uno.

For your servo project, please study the documentation and examples of the Servo library:
https://www.arduino.cc/en/Reference/Servo

OK
So this means i can't use analog input pins as PWM so can i use servo on any digital pin like in UNO 8,7 are not PWM can i use it to rotate servo at any desired angle?

Yes

OK Thanks alot you saved me

You're welcome. I'm glad if I was able to be of assistance. Enjoy!
Per

munish2411:
So this means i can't use analog input pins as PWM so can i use servo on any digital pin like in UNO 8,7 are not PWM can i use it to rotate servo at any desired angle?

Arduino's confusing nomenclature claims another victim...

analogRead() can be used on the pins with analog input ability, marked A0-A5.
digitalRead() can be used on all pins, including the "analog" ones, which are simply digital pins with analog input ability.
analogWrite() is used to produce a PWM signal, which is not really an analog signal (it's a block wave), and which only works on selected digital pins (not the analog ones).

Now for your servo: it's a PWM type signal but it is not created through the hardware PWM function. Therefore you can use any digital pin (so D2-D13 and A0-A5) for your servo. D0 and D1 are also digital pins but are used for the Serial interface, so are better not used unless you are very sure you know what you're doing.