What will be the output of the following code C?
#include <stdio.h>
void solve(){
char ch[5] = "abcde";
int ans=0;
for(int i =0; i< 5; i++) {
ans += (ch[i] - 'a');
}
printf("%d", ans);
}
int main(){
solve();
return 0;
}
Qus
निम्नलिखित कोड का आउटपुट क्या होगा?
#include <stdio.h> void solve(){ char ch[5] = "abcde"; int ans=0; for(int i =0; i< 5; i++) { ans += (ch[i] - 'a'); } printf("%d", ans); } int main(){ solve(); return 0; }
A. 5
B. 20
C. 40
D. 10