laserlight
I dont want to use arrays in my program, I want alternative way.
Type: Posts; User: Azeem
laserlight
I dont want to use arrays in my program, I want alternative way.
i is a range of number from 1 to 10 and rem is remainder of entered digit. if statement compares whether i is equal to rem or not if i is equal to rem then count is incremented.
Yes, I understand but instead of using count array can I use count variable and use it in a loop?
I am storing the input in integer variable.
The challange is not to use arrays. Use modulo and division operation to calculate.
I am writing a program in which user enter any value and the program calculates the occurence of any digit in a number. For example, if user enter 4323122 the output should like this
3 is present...
I have modified my code by using compound termination condition
#include<stdio.h>
int main(void)
{
int a,b,i;
for(i=1; i<=4; i++)
{
for(a=0; a<=0 ; ++a)
#include<stdio.h>
int main(void)
{
int a,b,i;
for(i=1; i<=4; i++)
{
for(a=0; a<=0 ; ++a)
{
printf("%d",a);
ok i tried for 2 variables but i am getting another problem of printing alternate 0's and 1's :/
Yeah ok I will try. :)
Yeah it is mandatory to use 6 nested loop.
I have to use 6 nested loops.
I am having problem in choosing termination conditions for each nested for() loop.
use 6 nested loops to generate the output & my code is incomplete right now. I am not getting how to proceed further.
ok got it :)
#include<stdio.h>
int main(void)
{
int a,b,c,d,e,f,i;
for(i=1; i<=64; i++)
{
for(a=0; a<=0; ++a)
{
printf("%d",a);
The output Should be like this:
11931
it is mandatory to use nested for() loop. I am not allowed to use any decimal to binary conversion.
What are index variables?
Matticus
#include<stdio.h>int main(void)
{
int a,b,c,d,e,f,i;
for(i=1; i<=64; i++)
{
for(a=0; a<=0; ++a)
In short we have to print Truth Table of 6 bit binary digits as truth table covers all possible combinations.
i selected 6 variables for 6 bits and 1 variable to control outer loop which initializes with 1 and terminates at 64. This outer loop is to generate rows.
ok. variables should hold '0' & '1' as the program is for printing binary numbers. Possible combinations are 64 for 6 bit number. This means outer loop terminates at 64.
Adak... the object of this question is to generate truth table using nested for() loop.
i did a bit paper work. But didnt find any solution. I am facing problem in choosing termination condition for for() loop. I selected 6 variables for 6 bits.