Computer Science, asked by TbiaSamishta, 1 year ago

Accept a string S as input.c program must print the sum of the positions of the vowels in S.if the string does not contain any vowels then print -1.


samless123pcq81z: Which language?

Answers

Answered by aqibkincsem
0

#include <stdio.h>int main(){  int c = 0, count = 0, s=0, i=0;  char s[1000]; printf("Input a string\n"); gets(s);while (s[c] != '\0') {,,, if (s[c] == 'a' || s[c] == 'A' || s[c] == 'e' || s[c] == 'E' || s[c] == 'i' || s[c] == 'I' || s[c] =='o' || s[c]=='O' || s[c] == 'u' || s[c] == 'U'){  s=s+c;…i++;}..c++;}..if(i==0){..s=-1;}.printf("sum of the positions: %d", s);return 0;}

Similar questions
Math, 6 months ago