Professional Documents
Culture Documents
1. #include<iostream>
#include <math.h>
int main()
float score[5];
float a;
cin>>score[i];
highest=(score[i]);
else
highest=highest;
a=(highest-(score[i]));
cout<<a<<endl;
return 0;
2.
#include<iostream>
#include <math.h>
int main()
float score[10];
float a;
cin>>score[i];
highest=(score[i]);
else
highest=highest;
if(lowest>score[i])
lowest = score[i];
else ;
a=highest;
highest=lowest;
lowest=a;
return 0;
3.
#include<iostream>
int main()
int n;
float elm[n];
float a;
cin>>n;
cin>>elm[i];
cout<<elm[i]<<", ";
a=elm[i];
elm[i]=elm[j];
elm[j]=a;
cout<<elm[i]<<", ";
return 0;
4.
#include<iostream>
using namespace std;
int main()
float temp[10][4];
for(int j=0;j<4;j++)
cin>>temp[i][j];
};
for(int j=0;j<4;j++){
if(lowest>temp[i][j])
lowest = temp[i][j];
highest=temp[i][j];
else ;
return 0;
5.
#include<iostream>
int main ()
cin>>mat1[i][j];
cin>>mat2[i][j];
cout<<"||";
cout<<mat1[i][j]<<"\t";
cout<<"|| "<<endl;
cout<<"multiplied by"<<endl;
cout<<"||";
cout<<mat2[i][j]<<"\t";
cout<<"|| "<<endl;
mat3[i][j]=mat1[i][k]*mat2[k][j];
cout<<"||";
cout<<mat3[i][j]<<"\t";
cout<<"|| "<<endl;
6. #include<iostream>
#include<cstring>
int main()
char word[20];
char pal[20];
gets(word);
strcpy(pal,word);
strrev(pal);
if(strcmpi(word,pal)==0)
cout<<"palindrome";
else
cout<<"not";
return 0;
7. #include<iostream>
#include<cstring>
#include <cctype>
int main(){
char str[50];
char upper;
gets(str);
upper=toupper(str[i]);
cout<<upper;
}
a.
#include<iostream>
#include<string.h>
int main ()
char str[50];
int count = 0, i;
gets(str);
count++;
cout << "Number of words in the string are: " << count + 1;
return 0;
B. #include<iostream>
#include<string.h>
int main ()
char str[50];
int count = 0, i;
if (str[i] == '.')
count++;
cout << "Number of sentence in the paragraph are: " << count ;
return 0;