本文介绍了计算表行值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨frnds我有一个任务就像这个表有一个值

Hi frnds i have an task like The table has an value as

0 1 1 1 0 0
This actually the 1 row in this i need to find how mny 0's and 1's where present in it 





请帮帮我谢谢... ,,



pls do help me Thank You...,,

推荐答案

int noofzerors=0;
                int noofones = 0;
                for (int i = 0; i < dt.Columns.Count; i++)
                {
                    if (dt.Rows[0][i].ToString() == "0")
                    {
                        noofzerors++;
                    }
                    if (dt.Rows[0][i].ToString() == "1")
                    {
                        noofones++;
                    }

                }
                here you will get your result....regards :)



这篇关于计算表行值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 18:46