MCQ answers:
1. What is Gm 16 - 12
2. Sridhar - 90 marks
3. The average - 24 yrs
4. The average of 5 - increases by 1
5. In a class - 85
6. The average age - 16.44 yrs
7. The average marks - 61
8. Find the average - 525
9. The marks obtained - 77.33
10. There are five - 30 yrs
11. The average 5 - 76
12. The average 11 - 11.5
13. A school has - 66%
14. The average 20 - 50
15. The average - 2x
16. Of the 3 - 24,12,6
17. The average weight - not
18. The average of 15 - 168
19. There are 60 - cannot be
20. The average weight - 83 kgs
Program solution;
1. String Reverse First and Second Half(Id - 5301)
#include <stdio.h>
#include<stdlib.h>
int main(){
char s[1001];
scanf("%s",s);
int l=strlen(s);
for(int i=(l/2)-1;i>=0;;i--){
printf("%c",s[i]);
}
for(int i=l-1;i>=l/2;i--){
printf("%c",s[i]);
}
}
2. Count Embedded integers in String (Id - 5302)
#include <stdio.h>
#include<stdlib.h>
int main()
{
char s[1001];
scanf("%s",s);
int count=0,i=0,l=strlen(s);
while(i<l){
if(isdigit(s[i])){
count+=1;
while(isdigit(s[i])){
i+=1;
}
}
else{
i+=1;
}
}
printf("%d",count);
}
0 Comments