You are on page 1of 3

Abdul Ghaffar

Swen201101067

Swen-3B
Qno(01)

Program

#include<bits/stdc++.h>

using namespace std;

int n; char c;

void printNTimes(char c, int n)

cout << string(n, c) << endl;

int main()

cout<<"Enter the character =";

cin>>c;

cout<<"How many prints =";

cin>>n;

printNTimes(c, n);

return 0;

}
Output

Enter the character = &

How many prints = 4

&&&&

Qno(02)

Program

#include<iostream>

using namespace std;

int main()

int num, rem, rev=0;

cout<<"Enter the Number: ";

cin>>num;

while(num!=0)

rem = num%10;

rev = rem + (rev*10);

num = num/10;

cout<<"\nReverse = "<<rev;

cout<<endl;

return 0;

}
Output

Enter the Number: 1473

Reverse = 3741

You might also like