Skip to main content

Posts

Showing posts from June, 2013

wap to print the sum of the following series.

(2^2)+(2^2+2^4)+(2^2+2^4+2^6)+...........n terms. #include<stdio.h> void main() { int i,j,sum,seriesum=0,p,n; printf("enter the number"); scanf("%d",&n); for(i=1;i<=n;i++) {  p=2,sum=0; for(j=1;j<=i;j++) {  sum=sum+pow(2,p);  p=p+2; } seriesum=seriesum+sum; } printf("%d",seriesum); } NOTE-  i have compiled this program in  codeblocks  if u do it in turbo c++  use   conio.h   header file in the beginning  and  getch()   a the  last

wap to delete all vowels from a sentence and print the sentence without vowels.

#include<stdio.h> void main() { char sen[1000],sen2[100]; int i,a,count=0,j=0; gets(sen); a=strlen(sen); for(i=0;sen[i]!='\0';i++) {  if(sen[i]=='a'||sen[i]=='e'||sen[i]=='i'||sen[i]=='o'||sen[i]=='u')         count++;         else     {     sen2[j]=sen[i];     j++;     }     } printf("%d\n%d",i,a); printf("\n%s",sen2); } NOTE-  i have compiled this program in  codeblocks  if u do it in turbo c++  use   conio.h   header file in the beginning  and  getch()   a the  last