0
No.5 Lab 3
Posted by ေမၿမဳိ့သား
on
12:40 PM
in
C++ No.5 for 2nd year
#include "stdafx.h"
#include <iostream>
#include <stdio.h>
#include <iomanip>
#include <conio.h>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int i,n,a, max=0, koko=0;
cout << "Enter how many your loop ==>" ;
cin >> n;
for( i=1;i<=n;i++)
{
cin>> a;
if (max<a)
{
max= a;
koko = i;
}
}
cout << endl << endl << "\n\nMaximum of that Sequence ==> " << max;
cout << endl << endl << " \n\nLocation ===> " << koko ;
getch();
return 0;
}
#include <iostream>
#include <stdio.h>
#include <iomanip>
#include <conio.h>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int i,n,a, max=0, koko=0;
cout << "Enter how many your loop ==>" ;
cin >> n;
for( i=1;i<=n;i++)
{
cin>> a;
if (max<a)
{
max= a;
koko = i;
}
}
cout << endl << endl << "\n\nMaximum of that Sequence ==> " << max;
cout << endl << endl << " \n\nLocation ===> " << koko ;
getch();
return 0;
}


#include "stdafx.h"
#include <iostream>
#include <conio.h>
#include <stdio.h>
#include<math.h>
using namespace std;
void main()
{
double n,ans,a=0.5;
cout <<"enter your number ";
cin>>n;
ans=0;
while(a<n)
{
a=1.5*(a+1);
ans=a;
}
cout<<"answer = "<<ans;
_getch();
}
#include <iostream>
#include <conio.h>
#include <stdio.h>
#include<math.h>
using namespace std;
void main()
{
double n,ans,a=0.5;
cout <<"enter your number ";
cin>>n;
ans=0;
while(a<n)
{
a=1.5*(a+1);
ans=a;
}
cout<<"answer = "<<ans;
_getch();
}
Post a Comment