URi 1168:LED

⊃Source Code


#include<stdio.h>
#include<string.h>
int main()
{
int p,i,n,len,k;
char ch[102];
while(scanf(“%d”,&n)==1)
{
for(k=0;k<=n;k++)
{
gets(ch);
p=0;
len=strlen(ch);
for(i=0;i<=len;i++)
{
if (ch[i]==’1′)
p=p+2;
else if (ch[i]==’2’|| ch[i]==’3’|| ch[i]==’5′)
p=p+5;
else if (ch[i]==’6’|| ch[i]==’0’|| ch[i]==’9′)
p=p+6;
else if(ch[i]==’4′)
p=p+4;
else if(ch[i]==’7′)
p=p+3;

else if(ch[i]==’8′)
p=p+7;
}
if(k!=0)
printf(“%d leds\n”,p);
}
}
}

Advertisements

About waprogramming

I am in CSE,from CUET
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s