M

Manisha Agrawal • 9.34K Points
Tutor III

Q. What will be the result of the following code snippet?

Code:
#include <stdio.h>
void solve() {
    char ch[10] = "abcdefghij";
    int ans = 0;
    for(int i = 0; i < 10; i++) {
        ans += (ch[i] - 'a');
    }
    printf("%d", ans);
}
int main() {
    solve();
	return 0;
}
  • (A) 45
  • (B) 36
  • (C) 20
  • (D) 100

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.


Question analytics