Task 1 a:
#include<iostream>
using namespace std;
void display_even ();
int main()
display_even();
return 0;
void display_even()
for(int i=1;i<=25;i++)
if(i%2==0)
cout<<i<<endl;
}
Task 1 b:
#include<iostream>
using namespace std;
void display_odd ();
int main()
display_odd();
return 0;
void display_odd()
for(int i=1;i<=25;i++)
if(i%2!=0)
cout<<i<<endl;
}
Task 1 c:
#include<iostream>
using namespace std;
void sum_upto (int);
int main()
int n;
cout<<"Enter the number till which sum is to be calculated "<<endl;
cin>>n;
sum_upto(n);
return 0;
void sum_upto(int x)
{
int sum=0;
for(int i=1;i<=x;i++)
sum=sum+i;
cout<<sum<<endl;
Task 1 d:
#include<iostream>
using namespace std;
void fibonacci (int);
int main()
int n;
cout<<"Enter number of terms for series should be printed "<<endl;
cin>>n;
fibonacci (n);
return 0;
}
void fibonacci (int x)
int a=0, b=1;
if(x<0)
cout<<"Invalid number of terms "<<endl;
for(int i=0;i< x;i++)
cout<< a<<endl;
int n=a+b;
a=b;
b=n;
cout<<endl;
}
Task 1 e:
#include<iostream>
using namespace std;
void calculate_avg(int,int,int ,int,int,int);
int main()
int a,b,c,d,e,f;
cout<<"Enter an integer for average "<<endl;
cin>>a;
cout<<"Enter an integer for average "<<endl;
cin>>b;
cout<<"Enter an integer for average "<<endl;
cin>>c;
cout<<"Enter an integer for average "<<endl;
cin>>d;
cout<<"Enter an integer for average "<<endl;
cin>>e;
cout<<"Enter an integer for average "<<endl;
cin>>f;
calculate_avg(a,b,c,d,e,f);
return 0;
void calculate_avg (int a,int b,int c,int d,int e, int f)
int sum=0;
sum=a+b+c+d+e+f;
float avg=sum/6;
cout<<"Average = "<<avg<<endl;
Task 1 f:
#include<iostream>
using namespace std;
int prod_of_digit(int);
int main()
int a;
cout<<"Enter a number of your choice "<<endl;
cin >>a;
cout<<"The product of digits of number are " << prod_of_digit(a)<<endl;
return 0;
int prod_of_digit(int x)
int prod=1;
for(int i=1;x!=0;i++)
int d=x%10;
x=x/10;
prod=prod*d;
return (prod);
Task 1 g:
#include<iostream>
using namespace std;
bool palindrome_check(int);
int main()
int a;
cout<<"Enter a number of your choice "<<endl;
cin >>a;
if( palindrome_check(a)==1)
cout<<"The number is palindrome " <<endl;
else
cout<<"the number is not a palindrome "<<endl;
return 0;
bool palindrome_check(int x)
int number=x,reverse=0;
while(x>0)
int d=x%10;
reverse=reverse*10+d;
x=x/10;
if(reverse==number)
return (1);
else
return (0);
}
Task 1 h:
#include<iostream>
#include<windows.h>
#include<conio.h>
using namespace std;
void atm_manue (void);
int main()
atm_manue();
return 0;
void atm_manue(void)
int a;
cout<<"Press 1 - Balance Inquiry"<<endl;
cout<<"Press 2 - Cash Withdrawal"<<endl;
cout<<"Press 3 - Cash Deposit"<<endl;
cout<<"Press 4 - Transfer Funds"<<endl;
cout<<"Press 5 - Change Password"<<endl;
cout<<"Press 6 - Exit"<<endl;
cin>>a;
system("CLS");
switch (a)
case 1:
cout<<"YOU ARE ON BALANCE INQUIRY PAGE "<<endl<<endl<<endl;
cout<<"Enter any key to go back "<<endl;
getch ();
system("CLS");
atm_manue();
break;
case 2:
cout<<"YOU ARE ON CASH WITHDRAWAL PAGE "<<endl<<endl<<endl;
cout<<"Enter any key to go back "<<endl;
getch ();
system("CLS");
atm_manue();
break;
case 3:
cout<<"YOU ARE ON CASH DEPOSIT PAGE "<<endl<<endl<<endl;
cout<<"Enter any key to go back "<<endl;
getch ();
system("CLS");
atm_manue();
break;
case 4:
cout<<"YOU ARE ON TRANSFER FUND PAGE "<<endl<<endl<<endl;
cout<<"Enter any key to go back "<<endl;
getch ();
system("CLS");
atm_manue();
break;
case 5:
cout<<"YOU ARE ON PASSWARD RESET PAGE "<<endl<<endl<<endl;
cout<<"Enter any key to go back "<<endl;
getch ();
system("CLS");
atm_manue();
break;
case 6:
cout<<"Thank you "<<endl;
exit(0);
break;
default :
cout<<"Enter from 1 to 6 ";