prev


Character Arrays - String manipulations:

91.No.of Lines in a Text(14.05.2010)

/*
Program# 91
date : 10-01-2009
No.of Lines in a Text
*/

#include <stdio.h>
main(){
char a[100];
int i,l;
i=0;

scanf("%c",&a[i]);
while(a[i]!='$'){
i++;
scanf("%c",&a[i]);
}
a[i]='\0';

i=0;l=0;
while(a[i]!='\0'){
if(a[i]=='\n')
l++;
i++;
}
printf("\n l=%d",l);
}



next
blog comments powered by Disqus