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


Latest Current Affairs 2024 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad