C program to read roll number and marks from user and display it on screen.
This program shows how to declare and use int variables. Read roll number and marks from user and display it on screen.
#include<stdio.h>
int main()
{
int marks,rollno;
printf("Enter your Roll No:");
scanf("%d", &rollno);
printf("Enter your Marks:");
scanf("%d", &marks);
printf("Your Roll No: %d.\n", rollno);
printf("Your marks: %d", marks);
return 0;
}
Output of the programEnter your Roll No:101Enter your Marks:70Your Roll No: 101.Your marks: 70
Simple Calculator using C/*Simple Calculator using C.Addition, Subtraction, Multiplication, and Division.*/#include<stdio.h>void main(){int number1, number2;printf("Enter number1:");scanf("%d",&number1);printf("Enter number2:");scanf("%d",&number2);printf("Addition of two numbers: %d\n", number1 + number2 );printf("Substraction of two numbers: %d\n", number1 - number2 );printf("Multiplication of two numbers: %d\n", number1 * number2 );printf("Division of two numbers: %d\n", number1 / number2 );}Output of the programEnter number1:10Enter number2:5Addition of two numbers: 15Substraction of two numbers: 5Multiplication of two numbers: 50Division of two numbers: 2
No comments:
Post a Comment