Report Bug

Qus

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


Solution
D. 10



Explanation


CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad