Hello Rubina Jones
The issue might be related to the power plan that you may have chosen or any accidental misconfiguration in the currently active plan settings.
Restoring the power plan settings back to default sometimes resolves the issue. Here is how you can do this:
Step 1 - Go to Control Panel > System and Security > Power Options.
Step 2 - From the right pane of the Power Options window, click the Change plan settings link representing the currently active power plan (the one with the radio button selected).
Step 3 - From the next window, click the Restore default settings for this plan link from below the manual power plan settings section.
Step 4 - Save the changes and then try plugging the laptop to charging.
If the issue persists, try switching to a different power plan. (May be to High performance available under the Show additional plans section in the right pane of the Power Options window.)
Let me know if this works. Good Luck!!