Assignment 1-3
Assignment 1-3
Get a number from user and add 2 to that number and print the result.
Code:
//2022510023-ITHIKASH R
#include <stdio.h>
int main() {
int number;
scanf("%d", &number);
number += 2;
return 0;
Output:
Question2:
Get a number from user and subtract 5 to that number and print the result.
Code:
//2022510023-ITHIKASH R
#include<stdio.h>
int main() {
int number;
scanf("%d", &number);
number -= 5;
Output:
Question3:
Get a number from user and multiply 3 to that number and print the result.
Code:
//2022510023-ITHIKASH R
#include<stdio.h>
int main() {
int number;
scanf("%d", &number);
number *= 3;
return 0;
Output:
Question4:
Get a number from user and divide by the number by 6 and print the Quotient.
Code:
//2022510023-ITHIKASH R
#include<stdio.h>
int main() {
int number;
scanf("%d", &number);
number /= 6;
return 0;
Output:
Question5:
Get a number from user and divide by the number by 8 and print the remainder.
Code:
//2022510023-ITHIKASH R
#include<stdio.h>
int main() {
int number;
scanf("%d", &number);
number %= 8;
Output:
Question6:
Get a two-digit number from user and print the one’s digit.
Code:
//2022510023-ITHIKASH R
#include <stdio.h>
int main() {
int number;
scanf("%d", &number);
return 0;
Output:
Question7:
Get a two-digit number from user and print the ten’s digit.
Code:
//2022510023-ITHIKASH R
#include <stdio.h>
int main() {
int number;
scanf("%d", &number);
return 0;
Output:
Question8:
Get a three-digit number from user and print the one’s digit.
Code:
//2022510023-ITHIKASH R
#include <stdio.h>
int main() {
int number;
return 0;
Output:
Question9:
Get a three-digit number from user and print the hundred’s digit.
Code:
//2022510023-ITHIKASH R
#include <stdio.h>
int main() {
int number;
scanf("%d", &number);
return 0;
}
Output:
Question10:
Get a three-digit number from user and print the ten’s digit.
Code:
//2022510023-ITHIKASH R
#include <stdio.h>
int main() {
int number;
scanf("%d", &number);
return 0;
Output:
Question11:
Get a two-digit number from the user and print sum of the digits.
Code:
//2022510023-ITHIKASH R
#include <stdio.h>
int main() {
scanf("%d", &number);
return 0;
Output:
Question12:
Get a three-digit number from user and print sum the digits.
Code:
//2022510023-ITHIKASH R
#include <stdio.h>
int main() {
scanf("%d", &number);
return 0;
Output:
Question13:
Get a two-digit number from user and print the reverse of the number.
Code:
//2022510023-ITHIKASH R
#include <stdio.h>
int main() {
scanf("%d", &number);
return 0;
Output:
Question14:
Get a three-digit number from user and print the reverse of the number.
Code:
//2022510023-ITHIKASH R
#include <stdio.h>
int main() {
return 0;
Output:
Question15:
Get a four-digit number from user and only reverse thefirst two digits of the number, then print the number.
Code:
//2022510023-ITHIKASH R
#include <stdio.h>
int main() {
scanf("%d", &number);
printf("Reversed number with only the first two digits reversed: %d\n", reversed_number);
return 0;
Output: