Closed Flowchart to Code

Status
Not open for further replies.

Oh No_

Forum Veteran
Elite
Joined
Sep 29, 2016
Posts
2,515
Reaction
781
Points
905
Guys medyo baguhan lang ako natutu mag code using c language nalilito ako sa flowchart ni sir na pina assignment nya..??
Screenshot_2020_0301_173017.jpgScreenshot_2020_0301_173026.jpg
Pasensya na cp lang kinaya sana may makatulong😅
 

Attachments

Self explanatory naman ang flow chart yan nga ang guide mo para magawa mo yung project mo. Logical statement lang yan.
 
di 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
 
Last edited:
di 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
Ok paps thanks nalilito kasi ako sa flowchart ni sir
 

yes 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");
}
 
Last edited:
yes 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");
}
Thanks po sa tips brother malaking tulong
 
Code:
#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
}
 
Status
Not open for further replies.

Similar threads

Back
Top