/* Accept initial velocity, acceleration and time. Print the Final velocity and Displacement. */ #include<stdio.h> main() { int u,a,t; float v,s; printf("Enter u, a, t - "); scanf("%d%d%d",&u,&a,&t); v=u+(a*t); printf("Velocity = %f",v); s=(u*t)+(0.5*a*t*t); printf(" Acceleration=%f",s); }
This is more like an initiative to digitize the basic codes which are required to be executed while learning computer science, computer application, information technology and computer engineering at Indian universities. As I graduated from the University of Pune, the list of codes I am going to publish are the one which I learned and executed while studying at my graduation.
Tuesday, 6 October 2020
Accept initial velocity, acceleration and time. Print the Final velocity and Displacement.
Friday, 12 June 2020
Define Class, Create Objects using Parameterized Constructor and Display the Object Count after each Object
class Student
{
int roll;
double per;
static int cnt=0;
student () {cnt ++}
student (int r, String nm, double p)
{
roll = r;
name=nm;
cnt++;
System.out.println("Counter= "+cnt);
}
public String toString()
{
return("Roll no "+roll+" Name= "+name+" Percentage= "+per);
}
public static void main(String args[])
{
Student s1= new Student (1,"Rohit",65.12);
System.out.println(s1);
Student s2= new Student (2,"Pranav",61.12);
System.out.println(s2);
Student s1= new Student (1,"Aditya",68.12);
System.out.println(s1);
System.out.println("Number of students: "+cnt);
}
}
Monday, 12 February 2018
Temperature Conversion using C
/*
Accept the temperature in Fahrenheit and print it in Celsius and kelvin using C.
*/
#include<stdio.h>
main()
{
int f;
float c,k;
printf("Enter f - ");
scanf("%d",&f);
c=(f-32)*(0.55555555555);
printf("Temperature in Celsius = %f\n",c);
k=c+273;
printf("Temperature in kelvin = %f\n",k);
}
Sunday, 11 February 2018
Accept the dimensions of a cylinder and print the surface area and the volume using C
/*
Accept the dimensions of a cylinder and print the surface area and the volume using C
*/
#include<stdio.h>
main()
main()
{
int r,h;
float sa,v;
printf("Enter r,h - ");
scanf("%d%d",&r,&h);
sa=2*(3.14)*r*(r+h);
printf("Surface Area = %f",sa);
v=(3.14)*r*r*h;
printf(" Volume=%f",v);
}
Tuesday, 23 January 2018
Hello Word
Happy Learning :)
Hello Word using C
Subscribe to:
Posts (Atom)