Attachments
-
You do not have permission to view the full content of this post. Log in or register now.
Ok paps thanks nalilito kasi ako sa flowchart ni sirdi ko alam ibig sabihin ng multiple o nakalimotan ko lang
pero kung ibig sabihin a number that can be divided many times which has no remainder gaya nito
num1 = 2;
num2 = 2;
(num1%num2 = 0) ay multiple
or
num1 = 2;
num3 = 1;
(num1%num2 = 1) not multiple
then baguhin mo yung if statement mo ng ganito
if (num3 == 0 ) {
//print multiple
}
else
//not multiple
e cocompare mu kasi yung result ng num3 if merong remainder if tama ako hahaha
Ganito bah brotherView attachment 793807
Thanks po sa tips brother malaking tulongyes sir pero dapat wala na yang else if dapat deretso na sa else tapos output print ka ng is not multiple
gaya ng sa else mo nung unang pic. at tska if magcocompare ka sa mga logical statements dapat '==' gamit mo instead of '=' sana naka tulong papi.
tska mas magandang coding practice yung ganito pagkahalay yung mga brackets
if(x==1) {
print("Sample");
}
else {
print("lalala");
}
#include<conio.h>//preprocessor directives
#include<iostream.h>//preprocessor directives
int main(){
int num1=100; //Declare num1 as integer and store 100 as its value
int num2,num3; //Declare num2, and num3
cout<<"Enter a number:"; //Ask the user to enter a number
cin>>num2;//This will insert value into num2
num3=num1%num2; //num3 stores the value of num1 modulo(%) num2
//conditional structure
if(num3==0){ //if the value of num3 is equal to zero then
cout<<num2<< "is multiple of "<<num1<<endl; //This output will be displayed
}else{//Otherwise
cout<<num2<< "is not multiple of "<<num1<<endl;//This output will be displayed
}
getch();//this function will hold temporarily the display
return 0;//Since our main functions data type is int, we need to return any value, for this example is 0
}