Cost of vegetables in c

 #include<stdio.h>

#include<stdlib.h>


int main()

{

int a,b=0;

scanf("%d\n",&a);

int c=34,p=20,t=25,s=30;

for(int i=0;i<a;i++)

{int e;char d;

scanf("%d %c\n",&e,&d);

if(d=='C')

printf("%d\n",c*e);

else if(d=='P')

printf("%d\n",p*e);

else if(d=='T')

printf("%d\n",t*e);

else if(d=='S')

printf("%d\n",s*e);

}

    

}

Comments

Popular Posts