GROUP ACTIVITY
Group A: Write a program to input 3 numbers and print their squares.
Answers
Answer:
#include <stdio.h>
int num1,num2,num3; /* declaration of three variables */
int sum;
char line_text[50]; /* line of input from keyboard */
int main()
{
printf("Input three numbers separated by comma : ");
fgets(line_text, sizeof(line_text), stdin);
sscanf(line_text, "%d, %d, %d", &num1, &num2, &num3);
sum = num1+num2+num3;
printf("The sum of three numbers : %d\n", sum);
return(0);
}
Answer:
In Your question you have not mentioned which programming language so as a computer student i m giving you C program answer
Explanation:
C++
int main()
int main(){
int main(){ int x;
int main(){ int x;
int main(){ int x; /* Print column names */
int main(){ int x; /* Print column names */ printf("Number\tSquare\tCube\n");
int main(){ int x; /* Print column names */ printf("Number\tSquare\tCube\n"); printf("=========================\n");
int main(){ int x; /* Print column names */ printf("Number\tSquare\tCube\n"); printf("=========================\n"); for(x=0; x<=20; x++)
int main(){ int x; /* Print column names */ printf("Number\tSquare\tCube\n"); printf("=========================\n"); for(x=0; x<=20; x++) printf("%d\t%d\t%d\n", x, x*x, x*x*x);
int main(){ int x; /* Print column names */ printf("Number\tSquare\tCube\n"); printf("=========================\n"); for(x=0; x<=20; x++) printf("%d\t%d\t%d\n", x, x*x, x*x*x);
int main(){ int x; /* Print column names */ printf("Number\tSquare\tCube\n"); printf("=========================\n"); for(x=0; x<=20; x++) printf("%d\t%d\t%d\n", x, x*x, x*x*x); return 0;
int main(){ int x; /* Print column names */ printf("Number\tSquare\tCube\n"); printf("=========================\n"); for(x=0; x<=20; x++) printf("%d\t%d\t%d\n", x, x*x, x*x*x); return 0;}